Below is what Tarikh-i-Sultan Mahmud-i-Ghaznavi(I don’t know it’s antecedents) says over Mahmud of Ghazni.
1. The father of the King was the Amir Sabaktagin, and his mother was the daughter of a noble of Zabalistan, for this reason he is (sometimes) called ‘Zabali,”
2. Another time the Sultan again sent him a letter, and wrote in it, “Leave Samarqand also to me.” The Caliph(Abbasi) said, “I ask shelter from the Pure God from this. I will not do this thing, and if you intend to take it without my consent I will make the whole world shake upon you.”
The Sultan was very angry at this saying, and said: ”Do you wish that I should go to you with thousands of elephants and upset your kingdom and level all your villages and cities, and having loaded their dust upon elephants that I should bring it to Ghazni.”
Just these two cases are sufficient to prove that Mahmud of Ghazni or Hammira of Garjanaka is no champion of Islam or an external invader for India. His father is a Kyrghyz Buddhist who was captured and sold off as a slave. His mother is from Zabul, which was seeing a see-saw battle between the Kabul Shahis and the Samanids. This clearly means the area is predominantly Hindu and he is no outsider, he just comes from that area which is Indian by definiton. Even, Ghazni’s Sanskrit Shahada on a coin, avyaktameka muhammada avatara nripati mahamuda asserts the same.
The second case clearly tells, he is ready to crush even the Caliph to achieve what he wants.If he is a pious and devout Muslim, he would never even have dreamed about turning his armies over the Caliph, the supreme power and the unifying force of Islam. By doing this, he has broken the unity of Islam for good. He just wanted to expand his territory, who cares if the loser is a Hindu or a Muslim?
And don’t forget that he is born of a Buddhist slave and possibly a Hindu/Buddhist mother(Zabuli noble) in a pre-dominantly Buddhist kingdom – what religion is he going to know? His teachers may be zealots but his parents? And then, the societal inferiority complex of being born to a slave, how high he may be in social stature. What will be the mental make of such a person be?