This is the story of the end of the mighty Kabul Shahis. When Trilochanapala became the king, Mahmud of Ghazni decided to invade the kingdom for another round of plunder. Trilochanapala anticipated it and asked his father-in-law Tunga, the de facto ruler of Kashmir to help. Tunga marched to Nandana but on hearing the news that the passes are blocked and Mahmud can’t cross the Khyber, he returned back. Eventually, Mahmud came.
Trilochanapala sent his son to hold Mahmud as long as he can and went to Kashmir to get an army. Trilochanapala’s son Bhimapala, immortalized in history as Nidar Bhim took his stand in Margalla Hills blocking Mahmud’s way. A spirited defense it was, Mahmud was stuck for more than a month. One of the two wings of his army was mauled and he had to send his personal guard to salvage the situation. Finally, Bhimapala understood he can’t hold Mahmud anymore and launched a vicious attack on Mahmud’s lines to buy time for his army to retreat.
A strong force was sent to hold Nandana and Bhimapala went towards his father. Mahmud’s ground intelligence was zero. He marched to the next logical destination - the Shahi capital city of Nandana. Another long siege and Nandana fell amidst much plunder. Once Nandana is finished, Mahmud decided to raid Kashmir as Bhimapala went off in that direction. But, surprise!! He comes across the main Shahi and Kashmir force under the overall command of Tunga. Trilochanapala asked his father-in-law to avoid a war and wear off Mahmud but Tunga was a proud man. He refused caution and strategy to a bull-headed fight and lost. And that loss broke his power and cost him his head. Trilochanapala understood where the fight was going and arranged an orderly retreat of the troops he was able to gather. He lost everything - except his army and his treasure chest. He is suddenly now a king without a kingdom. He marched off in the direction of Siwaliks and carved a kingdom there, with Hastinapur as his capital city. He had trouble with the Raja of Sharwa Chand Rai and rather than fighting him, sent Bhimapala to him as an emissary for the marriage of Bhimapala with the daughter of Chand Rai. Chand Rai was already angry against the Shahis for carving a kingdom out of his kingdom and arrested Bhimapala. Trilochanapala didn’t retaliate.
Slowly, Chand Rai understood the rationale and married his daughter to Bhimapala. Now, with his domains extending till Jhelum, Mahmud erupted on mainland India. Chand Rai decided to take a stand but Bhimapala asked him to flee. Mahmud landed upon an empty fort and angry, he doubled up his pace to catch Chand Rai. After that, he raided Kannauj where the Pratihara king fled on his approach and declared submission. Mathura and other places were taken before he returned back. Now, this is where our dear historians lie. When Mahmud left, Chandela Vidyadhara attacked Pratihara Rajyapala and killed him for fleeing in the face of a battle. An angry Mahmud decided to punish Vidyadhara for insulting him - this is what our historians wrote. But, what happened?
Mahmud received intelligence of a counter-invasion towards Indus from Ganga plains and decided to act before the invasion took shape. But, he didn’t know who was leading it and why. The fact is that Trilochanapala approached Vidyadhara for help to invade Mahmud’s territories. Sharwa and Kashmir will anyways join. It’s just a matter of conjecture what would have happened had the invasion took place. Anyways. Mahmud advanced towards Ganga but had to face severe resistance near Jhelum by a governor of Trilochanapala.
He still didn’t know whom he is fighting. Surprise!! When he reaches the Ganga area, he comes to know it’s Trilochanapala, the Shahi who fought him for more than a decade!! But, Trilochanapala was not ready to give him a war. He was just marching away - in other words, fleeing Mahmud and Mahmud was chasing him. Suddenly, Trilochanapala stopped and offered battle. In the battle, he was severely injured and died. His family was captured. Muslim writers mention he died in a riot in the camp after the defeat but it’s more probable that he died of his battle wounds. It’s more logical as you would see later. Because the king was injured and his men were desperate to cart him away, it’s possible that less attention was paid to his family leading to their capture. They were honorably returned later.
But, why did Trilochanapala flee first and stop suddenly? He didn’t flee. He was drawing Mahmud towards Vidyadhara’s main force. Some Muslim chronicler writes Vidyadhara was waiting with more than a lakh troops and 640 elephants. The sad part is Trilochanapala died but he achieved his aim. Mahmud is clueless about where he is, his supply lines are severely extended and he is facing an enemy who can crush him in a way that not even rumors of his death will reach his home!! Quickly, he concluded peace with Vidyadhara and fled home. Trilochanapala died but he achieved something which no one ever achieved in Indian history either before him or after - a confederacy for a cause. Yes. It was the same confederacy that made Mahmud flee back home through the desert after pillaging Somnath. And it was the same confederacy that crushed his nephew Salar Masud and pushed back the Muslims across Indus again for the next 150 years.
We learn that some desert tribe ambushed Mahmud in the desert on his way back from Somnath. Any guesses why he swore revenge and came back? Because it was the Shahi Bhimapala who attacked him and almost killed him, not some random opportunist!! Those accursed Shahis. They plugged Khyber Pass from Islam for 350 years and even after they lost everything including their kingdom, they never stopped in their attempts to stop those Muslims from pouring through the Khyber. Why wouldn’t Mahmud be angry at those who never stopped whatever? Did he throw against him? Bhimadeva Shahi, Jayapaladeva, Anandapala, Trilochanapala, and Bhimapala are the names we Indians are never supposed to forget and cherish what they did every day.