Is it a sin to keep haraam things in a mosque like gambling stuff, pork, idols?
I'm asking this because I had heard of a mosque which had allowed people to keep idols in only because it was raining.
Another such a case is here.
It is not permissible to keep or bring haraam things into house of Allaah.
The house of Allah is only for his remembrance and it is one of the noblest places. They must be cleansed from physical filth and haraam things - tangible and intangible. And without doubt, those things symbolizing shirk are most hateful and cannot be allowed inside the mosque.
Allaah says (interpretation of the meaning):
“In houses (mosques) which Allaah has ordered to be raised (to be cleaned, and to be honoured), in them His Name is remembered [i.e. Adhaan, Iqaamah, Salaat (prayers), invocations, recitation of the Qur’aan]. Therein glorify Him (Allaah) in the mornings and in the afternoons or the evenings” [ al-Noor 24:36 ]
And the Prophet (peace and blessings of Allaah be upon him) said:
“:These mosques are not for any of this urine and filth; rather they are for the remembrance of Allaah, may He be glorified and exalted, and prayer, and reading Qur’aan.” Narrated by Muslim (285).
The mosques are only built for the worship of Allaah, so they must be respected and kept free from all kind of sin and filth.