Mahmud Ghaznavid dies
The last four years of Mahmud's life were spent contending with the influx of Oghuz Turkic horse tribes from Central Asia, the Buyid Dynasty and rebellions by Seljuqs.
Initially the Seljuks were repulsed by Mahmud and retired to Khwarezm but Togrül and Çagrı led them to capture Merv and Nishapur (1028-1029). Later they repeatedly raided and traded territory with his successors across Khorasan and Balkh and even sacked Ghazni in 1037. In 1039 at the Battle of Dandanaqan, they decisively defeated Mahmud's grandson, Mas'ud I resulting in Mas'ud abandoning most of his western territories to the Seljuks.
Sultan Mahmud died on April 30, 1030. His mausoleum is located at Ghazni in modern Afghanistan.