On Tuesday, thousands of supporters of President Mahmoud Abbas's Fatah faction took to the streets for late-night celebrations of a court ruling expected to increase friction between Hamas and the mainstream group.
Hamas, which won 12 Rafah council seats to three for Fatah in the 5 May ballot, shrugged off the setback, saying it respected the court's decision and expected to do better in a re-vote. A date for the re-vote has yet to be set.
The court cancelled the results in 51 of Rafah's 141 polling stations after finding irregularities in voter registration lists and ballot boxes, said Osama Abu Safiya of the Supreme Committee for Local Election in Gaza.
He said nearly 40% of Gaza's 74,605 registered voters would be eligible to take part in new balloting.
Before the ruling was announced, Hamas accused Fatah leaders and the Palestinian Authority of pressuring the court to void the results.
Support for Hamas points
towards a strong political future
"The attempt to hurt Hamas, distort its image and ... accuse it of corruption is a very grave issue," Sami Abu Zuhri, a Hamas spokesman, told a news conference.
But Abd Allah al-Ifranji, head of Fatah's mobilisation and organisation bureau told Aljazeera: "The results of the court's decision were very good. The Palestinian judicial authorities are very honest and Mr Sami Abu Zuhri knows this very well and has admitted it."
Al-Ifranji said that about 29,000 people could not vote properly and that was why the court had to reconsider the subject.
Hamada Mkhaimar, a lawyer who represented Fatah at the hearings, said the faction proved to the court that some votes were cast in the names of people who were abroad, dead, or in jail.
Foreign observers said on election day that they had found no major problems.
In the ballot, Fatah secured about 50 of 84 municipal councils in the West Bank and Gaza Strip. But Hamas won around 30, including larger towns such as Rafah, and in Qalqilya in the West Bank.
"There is no big difference of votes between us [Fatah] and Hamas. That is why we hope the elections would continue without any problems," al-Ifranji said.
"There are open channels of understanding between us [Fatah] and Hamas and with all the other Palestinian resistance factions," he added.
Shaikh Hasan Yusuf, a top leader of Hamas, told Aljazeera: "We accept the choice of the Palestinian people whether we win or not, as we consider this a victory for the Palestinian judicial authorities, the Palestinian people and for the election process."
Hamas's strong showing was widely seen as an indicator of its political muscle, ahead of its groundbreaking participation in a Palestinian parliamentary election scheduled for July.