Assalaamu alaykum wa rahmatullaahi wa barakaatuhu. There is only one mosque in my city. My house is ten minutes walking away from the mosque. At Fajr, the mosque is opened sometimes and sometimes closed. I cannot know whether it will be opened or closed before the prayer time. I oftentimes went to the mosque but could not pray because it was closed. What is the limit, according to you, at which it is not necessary for me to go and look? I mean, when it is closed half of the time, or more, or less? I cannot get the keys; I asked for them before. When the mosque is closed, I pray with my wife at home.
All perfect praise be to Allah, the Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad is His slave and Messenger.
The scholars differed in opinion concerning the ruling of going to the mosque to pray in it and whether it is obligatory or recommended. According to the view that it is obligatory, then the obligation depends on hearing the athaan with the natural sound, without loudspeakers. So if you can hear the mu'aththin from that distance without him using loudspeakers, then you are obliged to go to the mosque to pray in it, and if you do not hear it, then you do not have to go to the mosque, but it is only recommended for you to do so.
Some scholars of Fiqh stated that the moderate voice is often heard from a distance of one mile. Haashiyat Ash-Sharwaani ‘ala Tuhfatul Muhtaaj reads, “It [the sound of the athaan] often does not exceed one mile...”
As for going to the mosque and finding it closed half of the times or more, as you mentioned, then our advice to you is to go and seek the reward of the steps that you take to the mosque if you do not find any hardship in doing so. If there is any hardship in doing so, then you pray in congregation with your wife at home, and we hope that you will get the reward of praying in congregation and that you are not sinful for not going to the mosque in this case, especially given that the majority of the scholars who are of the view that the congregational prayer is obligatory are not of the view that it is an obligation to perform it in the mosque. They held that the congregational prayer is fulfilled even if it is not performed in the mosque, so you may act according to this view.
You should try again with the mosque administration to ask for a copy of the key, as perhaps they might agree to give it to you if they see that you are keen to attend the prayer. You should remind them that they are obliged to open the mosque for the Fajr prayer and that they will be asked about this responsibility on the Day of Resurrection.
If they give you a copy of the key, then you yourself open it and you will get a good reward for doing so, Allah willing. If they refuse to give you a copy of the key, then you pray in congregation with your wife and you get the reward of congregational prayer as well as the reward of praying in the mosque, Allah willing. The Sunnah indicated that if a person is keen on doing an act of worship and he had a sound excuse that prevented him from doing it, then he will get its reward.
It is confirmed that the Prophet said, “When a person falls ill or travels, he will get the same reward for the deeds he did when he was a resident and in good health.” [Al-Bukhaari and Ahmad]
Ibn Hajar said when explaining this hadeeth, “As-Subki Al-Kabeer said in Al-Halabiyyat, ‘Whoever was used to praying with the congregation and then prayed alone for a valid excuse will obtain the reward of praying in congregation. But the one who was not used to praying with the congregation and then decided to pray with it but was hindered by an excuse and prayed alone, he will only obtain the reward for his intention, not that of praying with the congregation...’”
Besides, Shaykh Ibn ‘Uthaymeen said in Sharh Riyaadh As-Saaliheen, “He who wishes good and is keen on doing it, then if he was used to doing it but was prevented by any reason, a complete reward will be written for him [for that good deed even though he did not perform it].”
Allah knows best.
You can search for fatwa through many choices