GAZA/CAIRO — Rival Palestinian factions Hamas and Fatah signed a reconciliation deal Thursday after Hamas agreed to hand over administrative control of Gaza, including the key Rafah border crossing, a decade after seizing the enclave in a civil war.The deal brokered by Egypt bridges a bitter gulf between the Western-backed mainstream Fatah party of Palestinian President Mahmoud Abbas and Hamas, an Islamist movement designated as a terrorist group by Western countries.The rival parties’ agreement on Thursday came after senior Hamas and Fatah delegations met in Cairo over for two days.“The two sides agreed to measures to enable the [PA] national unity government to undertake its full responsibilities in administrating the affairs of the Gaza Strip as it does in the West Bank,” an official Egyptian statement published in PA media said. Fatah leader Azzam al-Ahmad, who led the Fatah delegation to the Egyptian capital, told a press conference in Cairo that “enabling the government” entails the PA taking over all the government institutions and bodies without exception. Ahmad added that his party and Hamas consented to the PA taking over Gaza’s border crossing with Egypt and Israel and deploying its security forces along the Egyptian-Gazan border. In previous attempts to restore the PA’s presence in Gaza, Hamas and Fatah agreed to place elite, American-trained PA Presidential Guard forces at the Rafah crossing. It is unclear if Hamas and Fatah were able to come to specific agreements on the future of Hamas’ armed wing. But PA President Mahmoud Abbas has said that he would not accept a scenario in which Hamas’ armed wing maintains control of its weapons. Meanwhile, Hamas leaders have said their armed wing’s weapons are not up for discussion. Both Abbas and Hamas Politburo Chairman Ismail Haniyeh welcomed Thursday’s agreement in Cairo. Palestinian unity could also bolster Abbas' hand in any revival of talks on a Palestinian state. Internal Palestinian strife has been a major obstacle to peacemaking, with Hamas having fought three wars with Israel since 2008 and continuing to call for its destruction.Hamas' agreement to transfer administrative powers in Gaza to a Fatah-backed government marked a major reversal, prompted partly by its fears of financial and political isolation after its main patron and donor, Qatar, plunged in June into a major diplomatic dispute with key allies like Saudi Arabia. They accuse Qatar of supporting Islamist militants, which it denies.An Israeli diplomatic official, speaking on the condition of anonymity, said that any agreement must abide by international terms, and that Israel ''will examine developments in the field and act accordingly.''Dozens of Palestinians took to the streets across Gaza on Thursday in celebration of the unity pact, with loudspeakers on open cars blasting national songs, youths dancing and hugging and many waving Palestine and Egyptian flags.“There’s a so much happiness here,” a Gaza City resident, who spoke on the condition of anonymity, said. “We hope that we will receive sufficient electricity and clean water and that we will be able to travel abroad.” Egypt helped mediate several previous attempts to reconcile the two movements and form a power-sharing unity government in Gaza and the West Bank, where Abbas and the Fatah-led Palestinian Authority (PA) are based.Hamas and Fatah agreed in 2014 to form a national reconciliation government but the deal soon dissipated in mutual recriminations with Hamas continuing to dominate Gaza. "The legitimate government, the government of consensus, will return according to its responsibilities and according to the law," Fatah delegation chief Azzam Al-Ahmed said at the signing ceremony in Cairo.He said the unity government would "run all institutions without exception," including all border crossings with Israel and in Rafah, Gaza's only access point with Egypt.Hamas Spokesman Sami Abu Zuhri said the agreement “ends a harsh era and restores the unity of our people.” The agreement calls for Abbas's presidential guard to assume responsibility of the Rafah crossing on November 1, and for the full handover of administrative control of Gaza to the unity government to be completed by December 1.Analysts said the deal is more likely to stick than earlier ones given Hamas's growing isolation and realization of how hard Gaza, its economy hobbled by border blockades and infrastructure shattered by wars with Israel, was to govern and rebuild.Deeper Egyptian involvement, believed to have been backed by Saudi Arabia and other Arab states, also helped cement the deal."We in Hamas are determined and are serious this time and just like all other times...We have dissolved the administrative committee (shadow government)...We have opened the door to reaching this reconciliation," Saleh Arouri, the head of Hamas negotiators in Cairo, said after the signing ceremony.Delegations from the two rival groups are working out the details of the administrative handover, including security in Gaza and at border crossings, in Cairo.Both rivals hope the deal's proposed deployment of security personnel from the PA to Gaza’s borders will encourage Egypt and Israel to lift tight restrictions at frontier crossings — a step urgently needed to help Gaza revive a war-shattered economy.Another major issue in talks on the deal was the fate of 40,000-50,000 public employees Hamas has hired in Gaza since 2007, a thorny point that helped crash the 2014 unity accord.Under the deal, these employees will receive 50 percent of what their PA salary would be — or equivalent to what they are being paid now by Hamas — pending vetting of their professional qualifications.Hamas and Fatah are also debating a potential date for presidential and legislative elections and reforms of the Palestine Liberation Organization (PLO), which is in charge of long-stalled peace efforts with Israel.The last Palestinian legislative election was in 2006 when Hamas scored a surprise victory. This sparked the political rupture between Hamas and Fatah, which eventually led to their short civil war in Gaza.Adam Rasgon contributed to this report.