This article needs additional citations for verification. (August 2012) (Learn how and when to remove this template message)
Ānandapāla or Anantpala was a ruler of the Hindu Shahi dynasty in present-day Afghanistan and Pakistan. His reign began in 1001 CE and ended in or about 1010. He was the son of Jayapala, whose kingdom used to stretch from Laghman to Kashmir and Sirhind to Multan, with Peshawar being in the center, but had lost most of his territories to Sabuktagin and his son Mahmud. Anandapala and his confederacy was defeated by Mahmud of Ghazni when his elephant suddenly took flight and turned the tide of the battle.
Prince Anandapala who ascended his father's throne in about March/April AD 1002 already proved an able warrior and general in leading many battles prior to his ascension. According to 'Adáb al-Harb' (pp. 307–10) in about 990 CE, it is written, "the arrogant but ambitious Raja of Lahore Bharat, having put his father in confinement, marched on the country of Jayapála with the intention of conquering the districts of Nandana, Jailum (Jehlum) and Tákeshar" (in an attempt to take advantage of Jayapala's concentrated effort with defence against the armies of Ghazni). "Jayapala instructed Prince Anandapala to repel the opportunist Raja Bharat. Anandapala defeated Bharat and took him prisoner in the battle of Takeshar and marched on Lahore and captured the city and extended his father's kingdom yet further."
However, during his reign as emperor many losses were inflicted on his kingdom by the Ghaznavids. During the battle of Chach between Mahmud and Anandapala, it is stated that "a body of 30,000 Gakhars fought alongside as soldiers for the Shahi Emperor and incurred huge losses for the Ghaznavids". However, despite the heavy losses of the enemy, he lost the battle and suffered much financial and territorial loss. This was Anandapala's last stand against Sultan Mahmud of Ghazni. He eventually signed a treaty with the Ghaznavid Empire in 1010 and shortly a year later died as a result of a natural death. R. C. Majumdar compared him ironically to his dynastic ancient famous ancestor "King Porus, who fought Alexander. And Tahqíq Má li'l-Hind finally revered him in his legacy as "noble and courageous".