The high court ordered the government to check into whether the Palestinian Authority, U.S., or U.N. would be willing to preserve the buildings - possibly delaying the final handover of Gaza to the Palestinians, set for mid-month.
Rabbis insist that Jewish law bans destruction of synagogues, while their critics charge the rabbis are playing politics, trying to preserve a focus of pain and protest against the Gaza pullout, which many Orthodox Jews hotly opposed.
Synagogues became a focus of resistance during the pullout. Hundreds of protesters - many of them "reinforcements" from outside the settlements - holed up in the synagogues. Most allowed themselves to be dragged out by soldiers, but many barricaded themselves on the roof of the Kfar Darom synagogue and pelted soldiers with water, paint and other liquids. Dozens were arrested and are facing charges.
Since then, some rabbis have gone to inspect the synagogues in the empty settlements, to ensure that the army has removed all holy books and religious materials. Last week a delegation of rabbis visited a Gaza synagogue, and one tore his clothes in the traditional Jewish sign of mourning at the prospect that the building would be destroyed.
Another member of the delegation, Simha Hacohen Kook, chief rabbi of the central Israeli city of Rehovot, said later it was "forbidden for Jews to tear down their own houses of worship. It would be better if others did it."
Dovish lawmaker Ran Cohen rejected the concept that the buildings themselves are holy. "That is a pagan attitude," he said, charging that the rabbis are making political points through religion. "It's more likely that they want to conduct a last-ditch campaign to prevent the destruction of Gush Katif," he said, referring to the largest Gaza settlement bloc.
Tuesday's high court ruling by a seven-judge panel came after Israel's chief rabbis ruled that it is forbidden to demolish synagogues. At least two of the synagogues are to be dismantled and rebuilt in Israel.
According to the court ruling, Sharon should "issue official requests to different authorities (the Palestinian Authority, the secretary of the United Nations and the president of the United States) in order to ensure that with the transfer of all of Gaza to Palestinian control, the synagogues will be preserved and not demolished."
Officials in Sharon's office said that the prime minister would make a formal request, but he doubted that the Palestinians would agree, and Israel would have to dismantle the synagogues.
Palestinian negotiator Saeb Erekat said the Palestinians don't want responsibility for the buildings. He said if the Palestinians knock down the synagogues, they will be subject to fierce Israeli criticism. But if they are left standing, Palestinian extremists might try to ransack the structures.
"This will put us in a very difficult position," Erekat said. "If we demolish them we are doomed, and if we don't, we are doomed."
An existing Cabinet decision calls for destruction of the synagogues, except for the two that are to be relocated in Israel. But experts warned that knocking down the buildings could reverberate outside Israel.
"This is not a political issue just to stop the withdrawal," said Eliezer Don-Yehiya, a political science professor with Bar-Ilan University. "Jewish law clearly states that you cannot demolish synagogues."
European countries with old synagogues that are no longer used are just waiting for Israel to demolish Jewish houses of worship so that they can do so as well, said Benjamin Lau, a Jerusalem rabbi and son of a former chief rabbi, Israel Meir Lau.
"If these countries see us doing it they will do it themselves," Lau said. "In terms of the Jewish world, this has tremendous implications."