Babar succeeded to the throne of Ferghana in 1494 when he was only 12 years old. However, he had to leave his ancestral throne due to the invasion of the Uzbeks, a Mongol group. Babur wandered for several years. Then in the year 1504, he seized Kabul. In 1526 he defeated the Sultan of Delhi, Ibrahim Lodi, at the battle of Panipat. Thus, he captured Delhi where he laid the foundation of the Mughal Empire. He became the first Mughal emperor and ruled from 1526 to 1530.