Abbas - Tanwîr al-Miqbâs min Tafsîr Ibn ‘Abbâs
(It is not for the idolaters) the idolaters ought not (to tend Allah's sanctuaries, bearing witness against themselves) through their calling (of disbelief. As for such, their works are vain) their works are thwarted for as long as they remain disbelievers (and in the Fire they will abide) never to die or leave it.
It is not for the idolaters to attend God’s places of worship (masājid, is also read in the singular, masjid), entering them or sitting in them, bearing witness, against themselves, to unbelief; those, their works have failed, [their works] are invalid, and in the Fire they shall abide.
It is not for Idolators to maintain the Masjids of Allah
Allah says that it is not fitting that those who associate others with Allah in worship should maintain the Masjids of Allah that were built in His Name alone without partners. Those who read the Ayah, "Masjid Allah'', said that it refers to Al-Masjid Al-Haram, the most honored Masjid on the earth, which was built, from the first day, for the purpose of worshipping Allah alone without partners. It was built by Khalil Ar-Rahman (the Prophet Ibrahim) peace be upon him. The idolators do this while they themselves testify to their disbelief with their statements and actions. As-Suddi said, "If you ask a Christian, `What is your religion', He will tell you he is a Christian. If you ask a Jew about his religion, he will say he is a Jew, and the same for a Sabi' and a Mushrik!'''
أُوْلَـئِكَ حَبِطَتْ أَعْمَـلُهُمْ
(The works of such are in vain), because of their Shirk,
وَفِى النَّارِ هُمْ خَـلِدُونَ
(and in Fire shall they abide.) Allah said in another Ayah,
(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 with Taqwa, but most of them know not.)8:34.
(The Masjids of Allah shall be maintained only by those who believe in Allah and the Last Day.) Therefore, Allah testifies to the faith of those who maintain the Masjids. `Abdur-Razzaq narrated that `Amr bin Maymun Al-Awdi said, "I met the Companions of the Prophet and they were saying, `The Masjids are the Houses of Allah on the earth. It is a promise from Allah that He is generous to those who visit Him in the Masjids.,'' Allah said next,
(perform the Salah), one of the major acts of worship practiced by the body,
(and give the Zakah), which is the best act that benefits other people,
وَلَمْ يَخْشَ إِلاَّ اللَّهَ
(and fear none but Allah), they fear only Allah, the Exalted, and none else,
(The Masjids of Allah shall be maintained only by those who believe in Allah and the Last Day;) "He who singles out Allah (in worship), has faith in the Last Day.'' And he said; "He who believes in what Allah has revealed,
(perform the Salah), establishes the five daily prayers,
(it may be they who are on true guidance.) Allah says, `It is they who are the successful ones in truth.' Similarly, Allah said to His Prophet,
عَسَى أَن يَبْعَثَكَ رَبُّكَ مَقَاماً مَّحْمُودًا
(It may be that your Lord will raise you to Maqam Mahmud)17:79. Allah says here, `Your Lord (O Muhammad) shall grant you a station of praise, that is, the intercession (on the Day of Resurrection).' Every `might' in the Qur'an means `shall'.''
Maududi - Sayyid Abul Ala Maududi - Tafhim al-Qur'an
This lays down the general principle for the guardianship of the places of worship that ave been built exclusively for the worship of Allah. Obviously, those people who associate others with Allah in His essence, His rights and His powers cannot be the proper persons to be the guardians, the servants, the managers etc. of such sacred places. And when they themselves reject the invitations to Tauhid, and openly declare that they are not going to dedicate their worship and obedience exclusively o Allah, they automatically forfeit any right they ad for the guardianship of such places of worship that had been built for the worship of Allah alone. Though the principle is of a general nature, it has been mentioned here with the particular object of removing the mushriks from the guardianship of the Ka`abah and Masjid-i-Haram and establishing permanently the guardianship of the worshipers of One God over them.
".........all their works have gone to waste.....", including the little real service they did to the `House of Allah' because they mixed with it shirk and other practices of ignorance. Their little good was destroyed by their far greater evils.
This question has been posed to bring home the fact that the guardianship of a shrine or attendance at it or other religious acts that are done for show, and are exploited by worldly people to establish and maintain the show of their piety, have no value whatsoever in the sight of Allah. The real worth of a person with Allah is that he should be sincere in his beliefs and make sacrifices in the Way of Allah, no matter whether he enjoys or does not enjoy such distinctions or happens to descend or not from a family of `saints'. On the contrary, those people who lack these excellences have no value with Allah, no matter whether they be the descendants of saints or inherit the guardianship of shrines from a long line of saints, or perform some `religious' acts for show on special occasions. And it is not lawful in any way that the guardianship, etc. of sacred places and institutions should be left in the hands of these worthless people just because they happen to inhere such rights from their forefathers.
(It is not for the idolaters to tend Allah’s sanctuaries…) [9:17]. The commentators of the Qur’an said: “When al-‘Abbas [ibn ‘Abd al-Muttalib] was taken prisoner on the Day of Badr, the Muslims went over to him and insulted him for his unbelief as well as for severing his ties of kinship, and ‘Ali [ibn Abi Talib] addressed him in a harsh way. Al-‘Abbas answered them: ‘How is it that you mention our evil deeds but you do not mention our good deeds?’ ‘Ali retorted: ‘Do you have any good deeds?’ He replied: ‘Yes, we tend to the Sacred Mosque, serve as gatekeepers of the Ka‘bah, provide water for the pilgrims, and relieve the afflicted’. Allah, glorious and majestic is He, revealed as an answer to al-‘Abbas (It is not for the idolaters to tend Allah’s sanctuaries)”.