Accordingly, travelling to these three mosques for prayer, supplication, remembrance, Qur’an recitation, or spiritual retreat (iʿtikāf) is one of the virtuous deeds. Concerning any other mosque, however, it is not prescribed to undertake a journey to it—this is the unanimous view of the scholars. Even Qubāʾ Mosque is merely recommended for those who are already nearby, such as the residents of Madinah; one is not to saddle mounts for the sake of reaching it.
For in the two Ṣaḥīḥs it is related from Ibn ʿUmar—may Allah be pleased with them both—that he said: “The Prophet—may Allah bless him and grant him peace—used to visit Qubāʾ Mosque every Saturday, whether on foot or riding.”(1) Ibn ʿUmar himself followed this practice. Muslim’s wording adds: “and he would pray two rakaʿāt there,”(2) while al-Bukhārī records the report without a chain.(3)
Allah the Exalted forbade him to stand in the Mosque of Dissension (Masjid Ḍirār), saying:
“Those who took for themselves a mosque in order to cause harm, disbelief, and division among the believers, and as an outpost for those who had previously fought Allah and His Messenger, will surely swear, ‘We intended nothing but good,’ yet Allah bears witness that they are indeed liars. Do not ever stand in it. A mosque founded upon piety from the very first day is more deserving that you stand in it—therein are men who love to purify themselves, and Allah loves those who purify themselves. Is the one who laid the foundation of his building upon reverent fear of Allah and His good pleasure better, or the one who laid the foundation of his building on the brink of a crumbling cliff, so that it collapsed with him into the Fire of Hell? Allah does not guide the wrongdoing people. Their building which they erected will remain a source of doubt in their hearts until their hearts are torn apart. And Allah is All-Knowing, All-Wise.” (al-Tawbah 9:107–110)(4)