"We've been holding our breath. God willing, this is a permanent agreement, not a temporary truce. We hope this will lead to lifting the siege," said Mahmoud Qassam, a fish seller watching the ceremony at his home in Gaza City's Shaati refugee camp, metres away from Haniya's home.

"Gaza has a different day and a different night," said Abu Ali Saleh, 50. "Gaza has not been this happy in years."

Drivers in Gaza City honked horns, sounded sirens and waved either green Hamas or yellow Fatah flags out of car windows after hearing news of the agreement.

Nour Odeh, Al Jazeera's Gaza correspondent, described the mood as one of "euphoria".

"Both parties have come to the realisation that one cannot cancel the other out."

Announcing the deal at the ceremony, Abbas aide Nabil Amr read a letter in which Abbas designated Haniya to draw up the new government according to the formula agreed on in the talks within five weeks.

Abbas said the deal would "satisfy our people ... and bring us to the shores of peace ... This initiative has been crowned with success".

Agreed formula

As part of the deal, a major step towards averting civil war, the Hamas premier will keep his job, the key post of interior minister will go to an independent while Fatah will name a deputy prime mininster.

Palestinians celebrated the agreement onthe streets of Gaza [AFP]

Under the initial agreement, a copy of which was obtained by AFP, Hamas would take nine posts in a new government.

Another six would go to Fatah and one each to four other parties in parliament. Along with the interior portfolio, independents would also get foreign affairs and finance.

The document confirmed that Ziad Abu Amr, the former culture minister, had been nominated as foreign minister and Salam Fayyad as finance minister.

A Hamas official, speaking on condition of anonymity, said Abbas "will choose an independent interior minister from among five names that will be submitted to him by Hamas."

Meshaal also said it was vital that any deal reached be respected by world powers.

"The international community must respect our accord, recognise our Palestinian reality and deal with it seriously," he said.

Israeli reaction

Reacting to the agreement, an Israeli government spokeswomen said that any new Palestinian unity government must abide by previous Western demands regarding the Jewish state.

"Israel expects the new Palestinian government to accept and respect all three of the international community's principles - recognition of Israel, acceptance of all former treaties and a clear renunciation of all terror and violence," said Miri Eisin, a spokeswoman in the office of Ehud Olmert, the Israeli prime minister.

Margaret Beckett, the British foreign secretary, welcomed what she described as an "important" agreement between rival Palestinian factions.

"We welcome the ongoing efforts to end the violence and promote intra-Palestinian reconciliation," Beckett said in a statement released by the foreign ministry.