Hamas legislators gathering in Gaza on July 27 were treated to an unusual sight. Not only were their Fatah colleagues present for the first time in a decade, but the former head of the Preventative Security Force in Gaza, Mohammed Dahlan, once a bitter rival of Hamas, addressed the gathering by videoconference from his base in the United Arab Emirates (UAE).

The event was the most visible demonstration to date of a reported agreement that surfaced in late June, under which Dahlan would become prime minister of Gaza and control border crossings with Israel, while Hamas would retain control of the Interior Ministry. Egypt would reopen the Rafah border crossing, effectively breaking the siege of Gaza. Other reports have included even more expansive, but also less credible, versions of the agreement, in which Egypt would cede a slice of territory in northern Sinai contiguous to Gaza to allow for the creation of a Palestinian mini-state.

Whatever the shape of the deal, a few things were clear. Hamas has become desperate for relief after several years of a pincer-movement blockade by Israel and Egypt, and had for some time been demonstrating a willingness to improve relations with Cairo. Egyptian President Abdel Fattah al-Sisi had abandoned earlier efforts to isolate or crush Hamas (an offshoot of the Egyptian Muslim Brotherhood, which Sisi has declared a terrorist organization), deciding he needed the group’s help in preventing weapons and militants from further enflaming the insurgency in Sinai.

Sisi and the UAE, who have long championed Dahlan over Palestinian Authority (PA) President Mahmoud Abbas, decided that now was the time to make their move, while Qatar, a Hamas backer, was neutralized by the Gulf crisis. It was all made easier by the recent leadership change in Hamas, because the movement’s new leader in Gaza, Yahya Sinwar, and Dahlan knew each other as boys in the Khan Yunis refugee camp. Egyptian intelligence reportedly reunited the two in Cairo early June.

Can Gazans benefit from the arrangement? If Dahlan and Hamas are able to find a way of cooperating in running Gaza—not a sure thing given their history of bad blood—it could produce tangible benefits for the long-suffering people of the territory. Dahlan’s close relationships with the UAE and Egypt bring to the table two things that Hamas needs to run Gaza: significant financial resources (from the UAE) and access to the outside world (through the Rafah border crossing).

The recent easing of the electricity crisis, caused by Abbas’ decision to cut power to Gaza, demonstrates how this can work. Dahlan was instrumental in arranging emergency fuel supplies from Egypt and winning a longer-term pledge from the UAE to fund a new power plant for Gaza. Such cooperation between Dahlan and Hamas also represents a potentially more effective approach to solving Gaza’s problems, where Gazans work with each other rather than look to the distant PA in Ramallah for solutions. One question that remains is whether Dahlan and Hamas intend to continue collaborating on a limited case-by-case basis, as they did over electricity, or whether their ultimate goal is to share power and responsibilities in Gaza.

Another question is how Abbas might react as events unfold. Will he respond by further cutting the PA’s ties to Gaza, thereby exacerbating the existing split, or will he compromise to seek his own reconciliation with Hamas?

For Palestinians more broadly, whatever form the Dahlan-Hamas arrangement takes, it has the potential to reshape politics, which have been fractured for more than a decade—with Hamas running Gaza and the Fatah-dominated PA ruling the West Bank. Dahlan will presumably seek to cast his cooperation with Hamas as promoting Palestinian unity, something that remains widely popular among all Palestinians. Dahlan cannot deliver reconciliation between Hamas and Fatah in the near term—Abbas has pushed Dahlan and his supporters out of Fatah. But his cooperation with Hamas in Gaza could establish a template for broader cooperation between the two movements in a post-Abbas period.

Ultimately, Dahlan’s goal is presumably to enhance his political standing as the jockeying begins to succeed Abbas as leader of Fatah, the Palestine Liberation Organization, and president of the PA. To the extent that he can show that his actions benefit the people of Gaza and promote much-desired Palestinian unity, he will give himself an important head start over his rivals.

Recent polling suggests he needs the boost. In late June, Dahlan garnered about 18 percent of public support in Gaza as a candidate to replace Abbas, but only 1 percent in the West Bank. Imprisoned Fatah leader Marwan Barghouti, by comparison, garnered a similar amount of support in Gaza, but 44 percent support in the West Bank. Hamas leader Ismail Haniyeh polled significantly higher than Dahlan in both places.

For Egypt and Israel, the agreement has short-term benefits, but also risks. A more economically stable and less desperate Gaza, in which a Fatah strongman exerts some control over Hamas and discourages external adventures, would be in the interest of both states. But while Sisi seems to have unalloyed enthusiasm for Dahlan—going so far as to bar rival Fatah leader Jibril Rajoub from entering Egypt last February—views of his reliability in Israel are mixed. Defense Minister Avigdor Lieberman is reportedly an enthusiast, while memories persist in the Israel Defense Forces of Dahlan’s perfidy when he was security chief in Gaza.

One question that remains is whether Palestinians are content to let outsiders choose their leaders, or will at some point assert themselves to replace Abbas (more than 60 percent said he should resign in the recent poll). Outside powers such as Israel, Egypt, and the UAE can try to promote certain choices (Dahlan), constrain others (Hamas), and prevent still others (Barghouti), but in the end such plans often go awry. Local factors might still prevent Dahlan from gaining dominance, and even if he were to do so, he might prove to be far less tractable than his outside patrons expect.