Let's say Somu kills Gomu.
Did Gomu deserve it? Yes. Why? Shastras tell us Law of Karma decides your birth & death. So Gomu deserved to die exactly at that time in that manner.
So, can we let Somu go free? No. Why not? Because Somu committed a crime.
How can it be a crime if Gomu deserved it? Because Shastras tell us that murder is a crime.
But if murder is a crime, how will Gomu get the death he deserves? Shastras give the right of execution only to Raja (king/government/judge/police).
So if King executes Gomu, isn't it also murder? No. Why not? Because Shastras says that King must uphold justice by executing murderers. If not, the King will be punished by Bhagavan.
So even though the King kills, we can let him go free? Yes.
Somu is just a means through which Gomu gets his punishment.
Gomu cannot decide who/how he gets what he deserves. All that is certain is that he will get it.
It's a big cycle where sin gets transferred from victim to criminal, and it ends when shastras are followed:
...
Gomu killed Pappu. (Pappu's punishment is over, Gomu committed a crime)
Somu killed Gomu. (Gomu's punishment is over, Somu committed a crime)
Binny killed Somu. (Somu's punishment is over, Binny committed a crime)
King killed Binny. (Binny's punishment is over, King did not commit crime)
-end of chain-
Bhagavan gives a criminal some chance/time to repent before punishment is ordered.
If Somu had used his buddhi/manas to control himself, then Gomu will have time to repent, and if he doesn't, will eventually be punished by King.
If Binny had controlled himself, then Gomu will have time to repent, and if he doesn't, will eventually be punished by King.
But neither did. They interfered and disobeyed shastras, so they will also be punished.
In other words, if you follow shastras, you will not be punished.
You do not have the right to commit a crime and then say the victim deserved it.
If you say so, then police will punish you and say you deserved it.
Now, coming to your question, it can only be answered if we check whether Shastras allow or forbid what Mughals did.
And the answer is complicated - It is not a crime to wage war against another nation. It is the right/duty given to Kshatriyas. They will not be punished for either attacking or defending a country. Just like businessmen will not be punished for either opening or closing a factory.
After winning a war, the land belongs to the victorious Kshatriyas - the wealth and in some cases, even the unmarried women, are considered spoils of war. But torturing the innocent, the brahmins, the temples etc. are against dharma. So they will have to be punished for that. Whether they get punishment through us, or through themselves (most victims of terrorist attacks in Middle East are Muslims themselves), Bhagavan will decide that.
Now, according to dharma if Mughal kshatriyas are allowed to wage war against India, then Indian kshatriyas are also allowed to wage war in retaliation. It will not be a crime.
But suppose we do, and we win, it will still be a sin if we rape & pillage.
We cannot justify it by saying that 'They did it, so we can do it'.
If we do, then it will be the similar to Somu killing Gomu above. They would have gotten what they deserve, but then so will we.