When, therefore, Baber invaded India in 1525, the greater part of the country was Mahommedan, but it did not recognize the authority of the Afghan sultan of the Lodi dynasty, who resided at Agra, and also ruled the historical capital of Delhi. After having won the battle of Panipat (1526) Baber was no more acknowledged as emperor of India than his ancestor Timur had been. Baber, however, unlike Timur, had resolved to settle in the plains of Hindustan, and carve out for himself a new empire with the help of his Mogul followers. His first task was to repel an attack by the Rajputs of Chitor, who seem to have attempted to re-establish at this time a Hindu empire. The battle was fought at Sikri near Agra, and is memorable for the vow made by the easy-living Baber that he would never again touch wine. Baber was again victorious, but died shortly afterwards in 1530. He was succeeded by his son Humayun, who is chiefly known as being the father of Akbar. In Humayun's reign the subject Afghans rose in revolt under Sher Shah, a native of Bengal, who for a short time established his authority over all Hindustan. Humayun was driven as an exile into Persia; and, while he was flying through the desert of Sind, his son Akbar was born to him in the petty fortress of Umarkot. But Sher Shah was killed at the storming of the rock-fortress of Kalinjar, and Humayun, after many vicissitudes, succeeded in re-establishing his authority at Lahore and Delhi.
Humayun died by an accident in 1556, leaving but a circumscribed kingdom, surrounded on every side by active foes, to his son Akbar, then a boy of only fourteen years. Akbar the Great, the real founder of the Mogul empire as it existed for two centuries, was the contemporary of Queen Elizabeth of England. He was born in 1542, and his reign lasted from 1556 to 1605. When his father died he was absent in the Punjab, fighting the revolted Afghans, under the guardianship of Bairam Khan, a native of Badakshan, whose military skill largely contributed to recover the throne for the Mogul line. For the first seven years of his reign Akbar was perpetually engaged in warfare. His first task was to establish his authority in the Punjab, and in the country around Delhi and Agra. In 1567 he stormed the Rajput stronghold of Chitor, and conquered Ajmere. In 1570 he obtained possession of Oudh and Gwalior, In 1572 he marched in person into Gujarat, defeated the last of the independent sultans of Ahmedabad, and formed the province into a Mogul viceroyalty or subah. In the same year his generals drove out the Afghans from Bengal, and reunited the lower valley of the Ganges to Hindustan. Akbar was then the undisputed ruler of a larger portion of India than had ever before acknowledged the sway of one man. But he continued to extend his conquests throughout his lifetime. In 1578 Orissa was annexed to Bengal by his Hindu general Todar Mall, who forthwith organized a revenue survey of the whole province. Kabul submitted in 1581, Kashmir in 1587, Sind in 1592, and Kandahar in 1594. At last he turned his arms against the Mahommedan kings of the Deccan, and wrested from them Berar; but the permanent conquest of the south was reserved for Aurangzeb.