The Idolators deserved Allah's Torment after Their Atrocities
Allah states that the idolators deserved the torment, but He did not torment them in honor of the Prophet residing among them. After Allah allowed the Prophet to migrate away from them, He sent His torment upon them on the day of Badr. During that battle, the chief pagans were killed, or captured. Allah also directed them to seek forgiveness for the sins, Shirk and wickedness they indulged in. If it was not for the fact that there were some weak Muslims living among the Makkan pagans, those Muslims who invoked Allah for His forgiveness, Allah would have sent down to them the torment that could never be averted. Allah did not do that on account of the weak, ill-treated, and oppressed believers living among them, as He reiterated about the day at Al-Hudaybiyyah,
هُمُ الَّذِينَ كَفَرُواْ وَصَدُّوكُمْ عَنِ الْمَسْجِدِ الْحَرَامِ وَالْهَدْىَ مَعْكُوفاً أَن يَبْلُغَ مَحِلَّهُ وَلَوْلَا رِجَالٌ مُّوْمِنُونَ وَنِسَأءٌ مُّوْمِنَـتٌ لَّمْ تَعْلَمُوهُمْ أَن تَطَيُوهُمْ فَتُصِيبَكمْ مِّنْهُمْ مَّعَرَّةٌ بِغَيْرِ عِلْمٍ لِّيُدْخِلَ اللَّهُ فِى رَحْمَتِهِ مَن يَشَأءُ لَوْ تَزَيَّلُواْ لَعَذَّبْنَا الَّذِينَ كَفَرُواْ مِنْهُمْ عَذَاباً أَلِيماً
They are the ones who disbelieved and hindered you from Al-Masjid Al-Haram (at Makkah) and detained the sacrificial animals from reaching their place of sacrifice. Had there not been believing men and believing women whom you did not know, that you may kill them and on whose account a sin would have been committed by you without (your) knowledge, that Allah might bring into His mercy whom He wills if they (the believers and the disbelievers) had been apart, We verily, would have punished those of them who disbelieved with painful torment. (48;25)
Allah said here,
وَمَا لَهُمْ أَلاَّ يُعَذِّبَهُمُ اللّهُ وَهُمْ يَصُدُّونَ عَنِ الْمَسْجِدِ الْحَرَامِ وَمَا كَانُواْ أَوْلِيَاءهُ إِنْ أَوْلِيَأوُهُ إِلاَّ الْمُتَّقُونَ وَلَـكِنَّ أَكْثَرَهُمْ لَا يَعْلَمُونَ
And why should not Allah punish them while they hinder (men) from Al-Masjid Al-Haram, and they are not its guardians!
None can be its guardians except those who have Taqwa, but most of them know not.
Allah asks, `why would not He torment them while they are stopping Muslims from going to Al-Masjid Al-Haram, thus hindering the believers, its own people, from praying and performing Tawaf in it'
Allah said,
وَمَا كَانُواْ أَوْلِيَاءهُ إِنْ أَوْلِيَأوُهُ إِلاَّ الْمُتَّقُونَ
And they are not its guardians. None can be its guardians except those who have Taqwa,
meaning, the Prophet and his Companions are the true dwellers (or worthy maintainers) of Al-Masjid Al-Haram, not the pagans. Allah said in other Ayah,
مَا كَانَ لِلْمُشْرِكِينَ أَن يَعْمُرُواْ مَسَاجِدَ الله شَـهِدِينَ عَلَى أَنفُسِهِم بِالْكُفْرِ أُوْلَـيِكَ حَبِطَتْ أَعْمَـلُهُمْ وَفِى النَّارِ هُمْ خَـلِدُونَ
إِنَّمَا يَعْمُرُ مَسَـجِدَ اللَّهِ مَنْ ءَامَنَ بِاللَّهِ وَالْيَوْمِ الاٌّخِرِ وَأَقَامَ الصَّلَوةَ وَءاتَى الزَّكَوةَ وَلَمْ يَخْشَ إِلاَّ اللَّهَ فَعَسَى أُوْلَـيِكَ أَن يَكُونُواْ مِنَ الْمُهْتَدِينَ
It is not for the polytheists, to maintain the Masjids of Allah, while they witness disbelief against themselves. The works of such are in vain and in the Fire shall they abide.
The Masjids of Allah shall be maintained only by those who believe in Allah and the Last Day; perform the Salah, and give the Zakah and fear none but Allah. It is they who are on true guidance. (9;17-18)
and,
وَصَدٌّ عَن سَبِيلِ اللَّهِ وَكُفْرٌ بِهِ وَالْمَسْجِدِ الْحَرَامِ وَإِخْرَاجُ أَهْلِهِ مِنْهُ أَكْبَرُ عِندَ اللَّهِ
But a greater (transgression) with Allah is to prevent mankind from following the way of Allah, to disbelieve in Him, to prevent access to Al-Masjid Al-Haram (at Makkah), and to drive out its inhabitants, (2;217)
Urwah, As-Suddi and Muhammad bin Ishaq said that Allah's statement,
إِنْ أَوْلِيَأوُهُ إِلاَّ الْمُتَّقُونَ
(None can be its guardians except those who have Taqwa),
refers to Muhammad and his Companions, may Allah be pleased with them all.
Mujahid explained that;
this Ayah is about the Mujahidin (in Allah's cause), whomever and wherever they may be.
Allah then mentioned the practice of the pagans next to Al-Masjid Al-Haram and the respect they observed in its vicinity