Is it permissible
    to sell a mosque if there are no longer Muslims living around it?
Question

                What is the ruling on selling a mosque
      if the Muslims have moved away from the area where it is located, and there is the fear
      that it may fall into a state of disrepair or be taken over by others? Often Muslims buy a
      house and convert it into a mosque, then when the majority of Muslims move away from the
      area because of their work, the mosque is abandoned or neglected, and may be taken over by
      others. It is possible to sell it and replace it with another mosque to be established in
      the area where there are Muslims. What is the ruling on this sale or replacement? If it is
      not possible to replace it with another mosque, what is the best way to dispose of the
      money raised from the sale of the mosque?
Praise be to Allah.It is permissible to sell a mosque that is no longer used or that is in
    a location that has been abandoned by Muslims, or where there is the fear that it may be
    taken over by the kuffaar, on the condition that the money is used to buy another place
    that will be used as a mosque. And Allaah knows best.