Bābur founded the Mughal dynasty in the 16th century after conquering northern India from his base in Kabul. The empire was consolidated two generations later by his grandson Akbar and lasted until the mid-18th century, when its possessions were reduced to small holdings. The last Mughal, Bahādur Shah II, was exiled in 1857.