I am temporarly leading a mosque in a city in XXX till we have enough money to hire a scholar. The people in the mosque used to leave it open 24 Hours. Every day I go to pray Fajr, I found homeless people sleep in the mosque, turning the air-condition very high (we pay several thousands of dollars for electricity), as well as non-moslims, we found bottles of alchohols and few days ago, we found a drunk person sleeping in the bathroom of the mosque and we called the police to take him away. I suggested to close the mosque from inside as well as the gates outside between after Isha prayers (one or two hours after Isha) untill fajr prayers and give keys to most of people who come to pray Isha and Fajr including some students who used to study in the mosque at night. We bought locks and keys and start to lock the mosque daily. Some brothers dislike the idea and their argument is that we should close the doors of the mosque from inside and leave the outside gate open because the house of Allah should be opened 24 hours, and if some body come late at night after time of Isha prayers and he would like to pray, he will not be able to do so. Please sir, give me your opinion as soon as possible, because there are some people benefit from opening the mosque and try to make fitna in the mosque.
The basic principle is that the mosque should be open and not locked, so that Muslims can pray in the mosque at any time. Dogs used to come and go in the mosque at the time of the Prophet (peace and blessings of Allaah be upon him), as it says in Saheeh al-Bukhaari. But if that leads to bad consequences such as evil things taking place inside the mosque, then it should be locked as a precaution, and because warding off bad things comes before attaining good things. The same applies is there is some danger to the mosque’s property such as furniture, machines, etc.