In the early 16th century, Babur arrived from Ferghana and captured Kabul from the Arghun dynasty. Babur would go on to conquer the Afghan Lodi dynasty who had ruled the Delhi Sultanate in the First Battle of Panipat. Between the 16th and 18th century, the Uzbek Khanate of Bukhara, Iranian Safavids, and Indian Mughals ruled parts of the territory. During the Medieval Period, the northwestern area of Afghanistan was referred to by the regional name Khorasan. Two of the four capitals of Khorasan (Herat and Balkh) are now located in Afghanistan, while the regions of Kandahar, Zabulistan, Ghazni, Kabulistan, and Afghanistan formed the frontier between Khorasan and Hindustan. However, up to the 19th century the term Khorasan was commonly used among natives to describe their country; Sir George Elphinstone wrote with amazement that the country known to outsiders as "Afghanistan" was referred to by its own inhabitants as "Khorasan" and that the first Afghan official whom he met at the border welcomed him to Khorasan.