In this 1966 teshuva to HaRav Gedalia Anemer zt"l (who just passed away recently), Rav Moshe Feinstein deals with the question of whether or not a community may sell a shul if most of the people in the community have left and those who remain can barely afford to keep the shul open. The question is further complicated by the fact that it is likely that any buyer will turn the shul into a church. Additionally, it seems that the neighborhood in question is a rough one, and there are local hoodlums who vandalize the shul.
[ed. - It is not clear to me which community, if any in particular, is being referred to, but this does sound like what happened in Newark and Jersey City in the 1960's and 70's]
Rav Feinstein replies that the remaining members are not obligated to spend money to keep open a shul that they cannot afford. Furthermore, they should also move the sifrei Torah, and perhaps all sifrei kodesh in the shul into a safe place so that they are not vandalized. With regard to the fear of the shul becoming a church, Rav Feinstein says that even if the proceeds from the sale are not going to be used to build a new shul, nevertheless the shul can be sold without worrying what it is going to be used for. However, it is better to go through a broker, and specifically a non-Jewish one (so as to create several layers of possible לפני עור). Furthermore, Rav Feinstein allows the members to be active in the sale in the hopes that they will help keep the price high and thus the community will maximize its profit.