The emerging Middle East respiratory syndrome coronavirus (MERS-CoV) causes lethal respiratory infections mainly on the Arabian Peninsula. The evolutionary origins of MERS-CoV are unknown. We determined the full genome sequence of a CoV directly from fecal material obtained from a South African Neoromicia capensis bat (NeoCoV). NeoCoV shared essential details of genome architecture with MERS-CoV. Eighty-five percent of the NeoCoV genome was identical to MERS-CoV at the nucleotide level. Based on taxonomic criteria, NeoCoV and MERS-CoV belonged to one viral species. The presence of a genetically divergent S1 subunit within the NeoCoV spike gene indicated that intraspike recombination events may have been involved in the emergence of MERS-CoV. NeoCoV constitutes a sister taxon of MERS-CoV, placing the MERS-CoV root between a recently described virus from African camels and all other viruses. This suggests a higher level of viral diversity in camels than in humans. Together with serologic evidence for widespread MERS-CoV infection in camelids sampled up to 20 years ago in Africa and the Arabian Peninsula, the genetic data indicate that camels act as sources of virus for humans rather than vice versa. The majority of camels on the Arabian Peninsula is imported from the Greater Horn of Africa, where several Neoromicia species occur. The acquisition of MERS-CoV by camels from bats might have taken place in sub-Saharan Africa. Camelids may represent mixing vessels for MERS-CoV and other mammalian CoVs. It is unclear how, when, and where the highly pathogenic MERS-CoV emerged. We characterized the full genome of an African bat virus closely related to MERS-CoV and show that human, camel, and bat viruses belong to the same viral species. The bat virus roots the phylogenetic tree of MERS-CoV, providing evidence for an evolution of MERS-CoV in camels that preceded that in humans. The revised tree suggests that humans are infected by camels rather than vice versa. Although MERS-CoV cases occur mainly on the Arabian Peninsula, the data from this study together with serologic and molecular investigations of African camels indicate that the initial host switch from bats may have taken place in Africa. The emergence of MERS-CoV likely involved exchanges of genetic elements between different viral ancestors. These exchanges may have taken place either in bat ancestors or in camels acting as mixing vessels for viruses from different hosts.