President Mahmoud Abbas (left centre) chats with Hamas leader Khaled Meshaal Reuters

The rival Palestinian factions Fatah and Hamas have signed a landmark reconciliation pact aimed at ending their bitter four-year rift.

A ceremony marking the deal, which was mediated by Egypt, took place on Wednesday at the Egyptian intelligence headquarters in Cairo.

Speaking at the ceremony, the Hamas leader Khaled Meshaal said his faction was "ready to pay any price" for reconciliation among Palestinians, the Arabic satellite channel al-Arabiya reported.

The Palestinian president, Mahmoud Abbas, said the accord ended "four black years" that hurt national Palestinian interests. He also said at the ceremony that he would soon visit the Hamas-held Gaza Strip.

"We announce to Palestinians that we turn forever the black page of division," he said.

The pact provides for the creation of a joint caretaker Palestinian government before national elections next year.

Critics have cast doubt on the durability of the Egyptian-brokered accord, which has been denounced by Israel.

The deal calls for the formation of an interim government to run the occupied West Bank, where Abbas is based, and Hamas-controlled Gaza Strip and prepare for parliamentary and presidential elections within a year.

Palestinians see this reconciliation as crucial for their drive to establish an independent state in the territories captured by Israel in the 1967 war.

Abbas said in his opening address: "We announce the good news from Egypt which has always carried its national and historical responsibility towards the Palestinian people. Four black years have affected the interests of Palestinians. Now we meet to assert a unified will."

The ceremony was briefly delayed by a disagreement over protocol. Palestinian sources said the dispute was over whether Meshaal should sit on the podium with Abbas or among other Palestinian delegates in the hall.

At the ceremony, Abbas was initially on the podium to give his speech, and then Meshaal took the podium for his address.

"This is an historical moment documenting the real will of the Palestinian people. The people have taken a step to retrieve its unity," said the Egyptian intelligence chief Murad Muwafi.

Shortly before the ceremony, the senior Fatah official Nabil Shaath said: "The signing has been done. Everyone signed. Today is the crowning of this achievement."

A spokesman for Abbas, Nabil Abu Rdainah, said the deal was signed on behalf of Fatah by Azzam al-Ahmad and for Hamas by Mousa Abu Marzouk. It was not immediately clear why Meshaal and Abbas did not put their own signatures to the deal.

Palestinian officials said the ceremony was a "celebration". In Hamas-controlled Gaza, university students distributed sweets, sang and rallied to mark the deal.

"We are celebrating the achievement of this victory to end divisions and send a message to the Israeli occupation that your threats will not deter us from achieving reconciliation," said Ahmed Abu Arar, who was among those rallying.

The Israeli prime minister, Binyamin Netanyahu, has denounced the deal and stopped transferring Palestinian tax revenues to the Palestinian Authority, saying Fatah must choose between Israel and the Islamist group that he says is an enemy of peace.

The United States has reacted coolly to the reconciliation accord. A state department spokesman said the secretary of state, Hillary Clinton, spoke to Netanyahu and the Palestinian prime minister, Salam Fayyad, on Monday about the deal.

Spokesman Mark Toner told a news briefing in Washington that the United States would look at the formation of any new Palestinian government before taking steps on future aid.

"If and when a new Palestinian government is announced, we'll assess that based on its composition," Toner said. "Hamas needs to abide by the Quartet principles in order to play a role in the political process."

Egypt has set up a committee to oversee implementation of the accord. The ceremony was attended by representatives from the Arab League, Qatar, Oman and Arab members of the Israeli parliament.

"The Arab League will have a role in the follow-up with the Palestinians on the reconciliation process to ensure the process unfolds in due course," the league's spokesman Hisham Youssef said.