Seljuq dynasty
Sabuktigin's son, Mahmud of Ghazni, declared independence from the Samanid Empire and expanded the Ghaznavid Empire to the Amu Darya, the Indus River and the Indian Ocean in the east and to Rey and Hamadan in the west. Under the reign of Mas'ud I, the Ghaznavid dynasty began losing control over its western territories to the Seljuq dynasty after the Battle of Dandanaqan, resulting in a restriction of its holdings to modern-day Afghanistan, Pakistan (Punjab and Balochistan). In 1151, Sultan Bahram Shah lost Ghazni to the Ghurid king Ala al-Din Husayn.