The Qur’an commands Muslims to treat others as they would like to be treated, even if they must suffer through negative treatment. The amnesty Prophet Muhammad(sa) offered to his Meccan persecutors excellently personifies this teaching.
Anas relates that Prophet Muhammad(sa) said, “None of you has faith until he loves for his brother what he loves for himself.”  Some critics assert that “brother” in this Hadith refers only to fellow Muslims, but nothing supports this presupposition. In fact, Islam goes beyond the Golden Rule in teaching to respond to others with an even greater act. Prophet Muhammad(sa) said, “‘Help your brother, whether he is an oppressor or he is oppressed.’ The Prophet was asked: ‘It is right to help him if he is oppressed, but how should we help him if he is an oppressor?’ He replied: ‘By preventing him from oppressing others.’”  Thus, it is not just the duty of a Muslim to treat others as they would want to be treated, but also to have compassion on those oppressed and help them win their freedom from oppression, without them even having to ask.
Islam’s teaching is superior to the Golden Rule. Islam teaches that Muslims must treat others well no matter how they treat the Muslims: “Verily, Allah enjoins justice, and the doing of good to others; and giving like kindred”. 
Unlike the Old Testament’s teaching of equal retribution, the Holy Qur’an urges Muslims to forgive:
And the recompense of an injury is an injury the like thereof; but whoso forgives and his act brings about reformation, his reward is with Allah. Surely, He loves not the wrongdoers. 
The Holy Qur’an teaches that Muslims must deal justly with everyone, even those who may hate them:
O ye who believe! be steadfast in the cause of Allah, bearing witness in equity; and let not a people’s enmity incite you to act otherwise than with justice. Be always just, that is nearer to righteousness. And fear Allah. Surely, Allah is aware of what you do. 
The Golden Rule teaches to do unto others, as you would have them do unto you. In the aforementioned verse, the Qur’an commands Muslims to always treat others with justice, even if they act with animosity and injustice towards you. In other words, the Qur’an commands Muslims to treat others as they would like to be treated, even if they must suffer through negative treatment. The aforementioned example of amnesty Prophet Muhammad(sa) offered to his Meccan persecutors excellently personifies this teaching. In fact, Prophet Muhammad(sa) added that, “A Muslim who kills a covenanting disbeliever, would not even be able to perceive the breeze of paradise.”  The Qur’an likewise teaches that a Muslim who kills a covenanting disbeliever even unintentionally or by mistake, must in addition to fully paying the blood money to the heirs of the deceased, also free a slave. Such is the level of respect afforded to those with whom Muslims have pacts.
The Qur’an only forbids Muslims from befriending those individuals who are attacking or waging war against Muslims, while emphatically encouraging ties of kinship and alliance otherwise:
Allah forbids you not, respecting those who have not fought against you on account of your religion, and who have not driven you forth from your homes, that you be kind to them and act equitably towards them; surely Allah loves those who are equitable. Allah only forbids you, respecting those who have fought against you on account of your religion, and have driven you out of your homes, and have helped others in driving you out, that you make friends of them, and whosoever makes friends of them—it is these that are the transgressors. 
The Qur’an clearly says that Muslims are not forbidden from befriending those who have not fought them, and instead commands Muslims to, “be kind to them and act equitably towards them.” Contrary to the allegation, no religious qualifications are required before a people can be befriended. This verse demonstrates that the verses regarding “arresting and seizing” the idolaters apply only to those individuals who have persecuted Muslims on account of their faith, driven them out of their homes, and have incited others to persecute Muslims. In response, God has permitted Muslims to fight in self-defense.
But exactly when does Islam permit a Muslim to take up arms in self-defense? The Qur’an explains, “Permission to fight is given to those against whom war is made, because they have been wronged—and Allah indeed has power to help them.”  Thus, pre-emptive war finds no justification in Islam. Permission—not a commandment—is only granted once another party imposes war upon a non-violent party. Having established this principle, the Qur’an adds:
Those who have been driven out from their homes unjustly only because they said, ‘Our Lord is God’—And if God did not repel some men by means of others, there would surely have been pulled down cloisters and churches and synagogues and mosques, wherein the name of God is oft commemorated. And God will surely help one who helps Him. God is indeed Powerful, Mighty. 
This verse—the like of which does not exist in any other religious scripture, and did not exist in any secular constitution for centuries after—commands Muslims to champion universal religious freedom for all faiths. Unlike any other ancient scripture, the Qur’an specifically protects those who attend “cloisters, churches, and synagogues.” Moreover, Muslims must prefer protection of other faiths even to their own, as demonstrated by the Qur’an mentioning mosques last. Muslims are thus permitted to fight in self-defense when they are attacked, and to protect universal religious freedom for people of all faiths.
This verse recognizes and pre-empts what happens when a tyrant begins oppressing one faith and no one speaks up—the oppression spreads. Thus, 1,400 years prior to Martin Niemoller’s famous quote,  the Qur’an made it incumbent upon Muslims to fight for universal religious freedom. Contrary to this allegation, not only does the Qur’an teach compassion beyond the Golden Rule, it also encourages interfaith friendship, and is the only Divine scripture to mandate its adherents—Muslims—to fight on behalf of any person of any faith to ensure universal religious freedom.
 Bukhari, Book on Faith, Chapter: To love for a brother what one loves for himself is part of faith.
 Bukhari, Vol. 3, #624.
 Qur’an 16:91.
 Qur’an 42:41.
 Qur’an 5:9.
 Bukhārī, Kitāb al-Jizyah Wa’l-Muwāda‘ah, Bāb Ithm Man Qatala Mu‘āhadan Bi-Ghairi
 Qur’an 60:9-10.
 Qur’an 22:40.
 Qur’an 22:41.
 First they came for the communists, and I did not speak out because I was not a communist. Then they came for the trade unionists, and I did not speak out because I was not a trade unionist. Then they came for the Jews, and I did not speak out because I was not a Jew. Then they came for me and there was no one left to speak out for me.