However, his association with the Ghaznavids appears only in later sources.
Samanid rule in Balkh lasted until 997,
when their former subordinates, the Ghaznavids, captured it.
The royal families of Ghur and Ghazni were hereditary enemies and,
by that time, the Ghaznavids still ruled in the Punjab.
The year was 1173 and the young Ghurid prince, Muhammad Shahabuddin Ghori(his royal title was Mu'izzuddin),
had just conquered the Ghaznavids in Afghanistan.
But with the decline of the Ghaznavids, the rulers of Ghur began to assert themselves
and in the beginning of the twelfth century became virtually not only independent but started contending for power against the Ghaznavids.
Specifically, Sunni Islam
came to rule in Iran after the period Sunni were distinguished from Shi'a through the Ghaznavids from 975 AD, followed
by the Great Seljuq Empire and the Khwarazm-Shah dynasty until the Mongol invasion of Iran.