The World Federation One Stop Fiqh

Ruling 886

It is unlawful to make the floor, ceiling, roof, and walls inside a mosque impure, and whoever finds out that it has become impure must immediately purify it. And the recommended precaution is that the outside walls of the mosque should not be made impure as well, but if they become impure it is not necessary to purify them. However, if making the outside walls of a mosque impure amounts to disrespect of the mosque, it is of course unlawful and it is necessary to purify them to the extent that it is no longer considered disrespectful.