After the dissolution of Genghis Khan's empire, Afghanistan was a loosely organized collection of individual principalities. Early in the eighteenth century, the Persian Nader Shah took over Afghanistan (wresting much of it from Mogul and Persian control). His bodyguard, Ahmad Shah Durrani, assumed the leadership after Nader Shah's death, and in 1747 consolidated Afghanistan into a single country. After his death in 1772, however, the country returned to decentralized control. The lack of a central leadership effectively thwarted the efforts of both the British and the Russians to integrate Afghanistan into their respective empires: in spite of a number of wars with the British in the nineteenth century (beginning in 1839), Afghanistan remained unsubdued and independent of foreign imperial control.