The Palestinian high court in Ramallah has ordered the suspension of local elections in the West Bank and the Gaza Strip scheduled for October 8.
The elections would have been the first democratic exercise in the Palestinian territories in a decade but cannot go ahead after disputes between the rival Fatah and Hamas groups over candidate lists as well as the inability to hold the vote in East Jerusalem, which has been annexed by Israel.
"Elections can't take place in one place and not the other," the presiding judge of the Ramallah court said in his ruling.
"The election can't take place in Jerusalem and its neighbourhoods. Also, there are problems with the formation of courts in Gaza ... Therefore, the court decides to stop the election."
OPINION: Why the West and Israel should talk to Hamas
Hamas, which runs the Gaza Strip, boycotted the last Palestinian municipal elections in 2012, but was due to participate this year.
Fatah and Hamas have not contested an election since 2006 parliamentary polls, which Hamas won.
This year's vote was planned with 81-year-old president Mahmoud Abbas under heavy political pressure as opinion polls suggested most Palestinians would like him to step down.
Thursday's ruling follows court submissions by Hamas in Gaza against party lists drawn up by Fatah.
The dispute underlines the legal and political divisions between Abbas's Palestinian Authority, which governs in the Israeli-occupied West Bank, and Hamas, which has controlled Gaza since 2007.
The court will hold another session to consider the issue on September 21.
Fatah blamed Hamas for the dispute.
"We hold Hamas fully responsible for foiling the election, starting with the unjustified petitions it filed," Fatah spokesman Osama al-Qawasmi said, accusing Hamas of using "private courts" in Gaza to block Fatah's lists.
Hamas said Fatah was responsible.
"The high court decision is politically motivated and it came in order to rescue Fatah after its lists of candidates collapsed in a number of areas," said Hamas spokesman Sami Abu Zuhri.