Palestinian President Mahmoud Abbas's Fatah movement hammered an historic reconciliation deal with the rival Hamas group on Wednesday, agreeing to form an interim government and fix a date for general election within the year.

The deal, which took many officials by surprise, was thrashed out in Egypt and followed a series of secret meetings.

Open gallery view Palestinian President Mahmoud Abbas and Hamas leader Ismail Haniyeh in Gaza City on March 18, 2007. Credit: AP

"The two sides signed initial letters on an agreement. All points of differences have been overcome," said Taher Al-Nono, the Hamas government spokesman in Gaza. He added that Cairo would shortly invite both sides to a signing ceremony.

"We have agreed to form a government composed of independent figures that would start preparing for presidential and parliamentary elections," said Azzam al-Ahmad, the head of Fatah's negotiating team in Cairo.

"Elections would be held in about eight months from now," he added.

Abbas has been making a heavy push for reconciliation with Hamas, with which it held a unity government that collapsed during a five-day civil war in 2007 and ended with the Islamic militant group seizing power in the Gaza Strip. Fatah had already signed the reconciliation agreement in October 2009, but Hamas had until now refused to give up on demands it had set before the rival group.

The accord agreed upon on Wednesday was first reported by Egypt's intelligence service, which brokered the talks. In a statement carried by the Egyptian state news agency MENA, the intelligence service said the deal was hatched by a Hamas delegation led by Moussa Abu Marzouk, deputy head of the group's politburo, and Fatah Central Committee member Azzam al-Ahmad.

"The consultations resulted in full understandings on all points of discussions, including setting up an interim agreement with specific tasks and to set a date for election," the statement said.

It said the agreement would allow Egypt to invite all Palestinian factions to sign a national reconciliation agreement in Cairo in the next few days.

Restoring Palestinian unity is seen as crucial to reviving any prospect for a Palestinian state based on peaceful co-existence alongside Israel. Fatah, the mainstream Palestinian movement until a 2006 election victory by Hamas, backs negotiated peace but the Islamists reject it.

Al-Ahmad and Abu Marzouk said the agreement covered all points of contention, including forming a transitional government, security arrangements and the restructuring of the Palestine Liberation Organization to allow Hamas to join it.

Mahmoud al-Zahar, a senior Hamas leader who participated in the talks, said Wednesday's deal covered five points, including combining security forces and forming a government made up of "nationalist figures".

He said Hamas and Fatah would free respective prisoners.

Implementation of the accord is due to start following an official signing ceremony in Cairo, expected in early May.

Any interim government is unlikely to include Hamas officials in an effort to avoid the sort of international boycott that hit the Palestinians after the 2006 election.

A senior Egyptian intelligence official told Reuters on Wednesday that he expected Abbas and Hamas leader Khaled Meshal, who is based in Damascus, to attend the signing of the agreement in Cairo.

At news conference in Cairo, where the Fatah and Hamas leaders sat side by side, Ahmad said Palestinians had paid a heavy price for their infighting.

"We are proud that we now possess the national will to end our divisions so we can end the occupation of Palestine ... the last occupation in history."

Abu Marzouk added: "Our rift gave the occupation a chance. Today we turn a new page."

Prime Minister Benjamin Netanyahu has warned that reconciliation between the Palestinian Authority and Hamas could spell the end of the peace process. "You can't have peace with both Israel and Hamas," Netanyahu said, in remarks directed at Abbas. "Choose peace with Israel."

Israel, the U.S. and the EU consider Hamas a terror group because of its rocket attacks and suicide bombings aimed at Israeli civilians.

The U.S. administration, the largest single donor to the Palestinians, withheld funds when Hamas was a part of a short-lived Palestinian unity government. The Palestinian Authority is heavily reliant on foreign aid and forgoing the funds could easily spark its own crisis.

Since the bloody coup in 2007, the Palestinians have been divided between rival governments in the West Bank and Gaza, the two territories they hope to turn into an independent state.

With peace talks stalled since September, Abbas has begun an effort to win international recognition of Palestine, with or without an agreement with Israel. That effort is to culminate at the United Nations in September.

Palestinian officials have acknowledged the need solve their differences with Hamas before they can go to the United Nations. Abbas has made repeated overtures toward Hamas in recent months - including an offer to visit Gaza to lay the groundwork for national elections.

Hamas leaders had said they want a full power-sharing deal before meeting with the Palestinian president - including a deal on how to divide security responsibilities.

Hamas had also demanded further gestures from Abbas before considering unity, such as a release of hundreds of Hamas prisoners locked up in the West Bank, re-opening closed Hamas charities and the removal of a ban on Hamas activities in the West Bank.

The Palestinians receive more than $470 million a year in direct financial assistance from the U.S. The U.S. hasn't said what it will do if Hamas returns to power in the West Bank, but it will likely cut off the funds unless Hamas agrees to renounce violence and recognize Israel. Hamas has given no indication it is prepared to do either.