Fatah and Hamas announced in Cairo on Wednesday that they had agreed to a reconciliation agreement, ending four years of feuding between the Palestinian factions. The historic deal was greeted cooly in Jerusalem.

In an about-face, Hamas said that it would sign the agreement, which was drafted by the Egyptians and signed by Fatah in October 2009.

The agreement calls for a setting up a caretaker government of technocrats, and for holding presidential, parliamentary and National Palestinian Council elections within a year.

Prime Minister Benjamin Netanyahu denounced the move, attacking the Palestinian Authority for its willingness to reconcile with Hamas, which "aspires to the destruction of Israel." The reconciliation was a sign of weakness, he said.

Hamas had refused to sign despite repeated pleas by Egypt, in part because of apparent pressure from its two main patrons, Syria and Iran. The fall of Egypt's Mubarak regime two months ago may have pushed Hamas to change its stance.

The representatives of the two movements, Fatah's Azam Al-Ahmed and the deputy head of Hamas' Damascus political bureau, Mousa Abu Marzouk, met in Cairo at the invitation of the new Egyptian intelligence chief, Mourad Mouafi, and foreign minister Nabil Al-Arabi.

Next week, Palestinian President Mahmoud Abbas and Hamas politbureau head Khaled Meshal will meet to sign the final agreement, they said. Senior Hamas official Mahmoud al-Zahar, who also took part in the meeting yesterday, said that several clauses in the 2009 deal had been changed, which enabled Hamas to sign.

The parties also reached an agreement regarding who would sit on the central elections committee, and on a 12-judge committee to oversee the elections, al-Zahar said on Wednesday. A joint Hamas-Fatah defense committee will oversee the Palestinian security forces. The caretaker government will be composed of technocrats without party affiliation, to be chosen jointly by both parties.

The agreement raised surprise in Israel: While there had been intelligence about the move, Israeli sources had not expected the Palestinians to reconcile so soon.

It is not clear whether the process will go through, as several earlier agreements have collapsed.

Netanyahu on Wednesday called on the PA to choose between Hamas and Israel.

"You can't have peace with Hamas and with Israel," Netanyahu said.

Despite the harsh response, the reconciliation may well work to Israel's advantage. Israel has been struggling internationally, as more than 100 nations prepare to recognize a unilaterally declared Palestinian state in the UN in September. Renewed relations between Hamas and Fatah, however limited, could shed a different light on Abbas' intentions, and Netanyahu, who is due to speak before both houses of Congress next month, will be able to present the agreement as proof that Abbas doesn't really want peace.

If the reconciliation does indeed go through, Israel's immediate concern would be the future of security coordination with the PA. A Hamas foothold, however limited, would mean that Israel could not share intelligence with the PA.

Between the Hamas election victory in January 2006 and the Hamas coup in Gaza in mid-2007, Israel had been engaged in complex maneuvers to produce at least the appearance of completely excluding Hamas from any security arrangements.

If the reconciliation is accompanied by a mass release of Hamas prisoners from West Bank prisons, this would further increase the risk of terror attacks.

However, if Hamas is participating in a unity government, even if through technocrats, this would minimize the group's desire to renew the conflict on the Gaza front, which could help maintain calm there.

In the most optimistic scenario, the reconciliation may even improve the chances of a deal to return captive soldier Gilad Shalit. Hamas' military wing, which is holding Shalit captive, has presented very tough stances in its negotiations with Israel.

Reducing tension with Fatah and the daily friction with the Israel Defense Forces could create a more positive atmosphere for negotiations, and the PA may also scale back its opposition to a prisoner exchange. Until now, the PA has objected because it would be a massive coup for Hamas.

Both parties appear increasingly interested in implementing a deal, but many of the details remain unclear. One key detail is who the ministers will be, and more important still, who will lead it and what will happen to the incumbent prime ministers - Ismail Haniyeh of Hamas and Salam Fayyad of the PA.

The last question is particularly troubling for the PA, which has won much of the improvement in its international standing thanks to Fayyad's work. However, the personal grudge that many in both Hamas and Fatah hold against Fayyad may mean he will be the first to pay the price of unity. The agreement also does not detail how each party's security forces will be reformed, which in turn may influence international funding - the U.S. Congress in particular is unlikely to enthusiastically give hundreds of millions of dollars that may end up in the hands of Hamas in less than a year, should it win the elections.