Mahmud systemized plunder raids into India as a long-term policy of the Ghaznavids. The first raid was undertaken in September 1000, but was meant for reconnaissance and identifying the possible terrain and roads that could be used for future raids. He reached Peshawar by September 1001 and was attacked by Jayapala. The two sides clashed on 27–28 November 1001 and Jayapala was captured. Anandapala who was at Waihind, had to pay a heavy ransom to have his father and others released. Jayapala later self-immolated out of shame and Anandpala succeeded him. Mahmud attacked Anandpala later over his refusal to allow him passage during his attack on Multan, which was controlled by Fateh Daud. The two sides clashed in 1009 in the eastern side of Indus at Chhachh, with Mahmud defeating Anandapala and capturing the fort of Bhimnagar. He was allowed to rule as a feudatory in Punjab for some time. An alliance between Anandpala's son, Trilochanpala, and Kashmiri troops was later defeated. During the warfare from 990–91 to 1015, Afghanistan, and later Punjab and Multan were lost to the Ghaznavids. Trilochanpala's rule was limited to eastern Punjab and he gained respite from the Muslim invasions with retreat to Sirhind. He allied with the Chandellas and in 1020-21 was defeated at a river called Rahib by Al-Utbi, while Firishta and Nizamuddin Ahmad identify it as Yamuna. He was killed in 1021 AD by his mutinous troops and succeeded by Bhimapala, who became the last ruler of the Kabul Shahi and was killed fighting the Ghaznavids in 1026 AD. The remnants of the royal family sought refuge with the Lohara dynasty of Kashmir and Punjab passed under the control of Muslim conquerors. Mahmud used his plundered wealth to finance his armies which included mercenaries. The Indian soldiers, presumably Hindus, who were one of the components of the army, with their commander called sipahsalar-i-Hinduwan, lived in their quarter of Ghazni while practicing their own religion. Indian soldiers under their commander Suvendhray remained loyal to Mahmud. They were also used against a Turkic rebel, with the command given to a Hindu named Tilak according to Baihaki. The renowned 14th-century Moroccan Muslim scholar Ibn Battuta remarked that the Hindu Kush meant the "slayer of Indians", because the slaves brought from India who had to pass through there died in large numbers due to the extreme cold and quantity of snow. He states: Invasions of Ghur