The problem with all of this right now is that both sides are pushing a narrative of Hindu this and Muslim that. History is being abused in the name of modern politics.
In reality, Everyone was for themselves only.
Hindu Peasants would sit on a hill and watch Muslim armies defeat their own Hindu king, and vice versa. The reason for this is that people did not identify with their Hindu or Muslim rulers, they identified with their family and village only. Did it matter that you had to pay your taxes to Hindu, Buddhist, or Muslim kings? You paid regardless.
For example, Asoka the Great was not righteously fighting invading Muslims or Christians. He was invading fellow Hindu lands and we all know how brutal his military campaigns were.