In the turbulent times of the 12th century, when Islam was bent on taking over India, and Mohammad of Ghur (from Afghanistan) marched beyond the Punjab, Prithviraj III of Ajmer advanced to oppose the Muslim invaders with a large army. It included one hundred and fifty Rajput princes and their forces, including Rawal Mathan Singh of Mewar. Islam had been seeking the conversion of the world at the point of the sword. . Ghori decided to extend the boundary of his kingdom and also gain wealth, through conquests. To realize his ambition, he made his first incursion into India in 1175. After subduing the Ismaili Muslim heretics of Multan, he made an unsuccessful advance into Gujarat in 1178.
Nevertheless he became successful in seizing Peshawar and building a fort at Sialkot in 1181. With the help of the ruler of Jammu, Jaidev he put an end to the rule of Ghaznavids in Punjab and captured Lahore in 1186 A.D. With this the way was opened for him to push his conquests further into India. But he now had to face the formidable Rajputs led by the enigmatic Prithviraj Chauhan, ruler of Delhi and Ajmer.
For the defense of the country's north-west frontiers and what may be called the "Gateway" of India, the Chauhan ruler had strongly fortified the bordering towns of his kingdom. Muhammad Ghori first attacked Bhatinda and laid siege to the city in 1189. Historical evidences show that Prithviraj Chauhan was not prepared for this attack made in a sudden and deceitful manner. Hence the army defending the city was defeated and it laid down its arms after the defeat.
Muhammad Ghori left a garrison under the command of Ziauddin to defend the fort, and he himself prepared to back when the Chauhan ruler arrived at the head of a huge army to recapture the fort. So Ghori had to stay his departure in order to face Prithviraj. The rival armies met at Tarain, near Thaneshwar. In face of the persistent Rajput attacks, the battle was won as the Muslim army broke ranks and fled leaving their general Mahmud Ghori as a prisoner in Pritiviraj's hands.
Mahmud Ghori was brought in chains to Pithoragarh - Prithviraj's capital and he begged his victor for mercy and release. Prithviraj's ministers advised against pardoning the aggressor. But the chivalrous and valiant Prithviraj thought otherwise and respectfully released the vanquished Ghori.
Scenes of devastation, plunder and massacre commenced, which lasted through ages during which nearly all that was sacred in religion or celebrated in art was destroyed by these ruthless and barbarous invaders. The noble Rajput, with a spirit of constancy and enduring courage, seized every opportunity to turn upon his oppressor. But all was of no avail; fresh supplies were pouring in, and dynasty succeeded dynasty.