GAZA CITY, Gaza Strip — A power-sharing deal between two former arch foes is slowly taking shape in Gaza and could lead to big changes in the Hamas-ruled territory, including an easing of a decade-long border blockade.

In the latest sign that the Egypt-backed understandings are moving forward, Hamas permitted more than 2,000 supporters of its former nemesis, Mohammed Dahlan, to stage a rally in Gaza City on Thursday. They held up banners with large photos of the ex-Gaza strongman and signs reading, “Thank you, Dahlan.”

Dahlan backers also opened an office in Gaza last month as a springboard for political activity and began disbursing $2 million in Dahlan-procured aid from the United Arab Emirates to Gaza’s poor.

All involved appear to benefit from the new deal for Gaza, described in detail by key players.

Egypt, which is battling Islamic extremist insurgents in the Sinai Peninsula next to Gaza, hopes to contain the Islamic militant Hamas through new security arrangements.

Dahlan, forced into exile after falling out with Palestinian President Mahmoud Abbas in 2010, is poised to launch a comeback and advance his leadership ambitions.

Hamas gets a chance to prolong its rule with a promised easing of Gaza’s stifling border blockade. Egypt and Israel had imposed the closure after Hamas seized Gaza in a violent 2007 takeover that included battles with forces loyal to Dahlan.

The three-way agreement aims to revive Gaza’s battered economy and restore a sense of normalcy for 2 million Gazans, who have largely been barred from travel and trade for the past decade and have endured rolling power cuts, most recently of up to 20 hours a day.

Yet a stable Palestinian “mini-state” in Gaza could undermine long-standing Palestinian ambitions to set up an entity that is also meant to include the West Bank and east Jerusalem. Israel, which captured those territories in the 1967 Mideast War, withdrew from Gaza in 2005, but keeps a tight grip on the rest.

Abbas, who administers autonomous West Bank enclaves, has tried to negotiate a broader statehood deal with Israel, but his internationally backed efforts ran aground almost a decade ago, in part because of continued Israeli settlement expansion in east Jerusalem and the West Bank.

Israel’s hard-line government has said it would not withdraw to the pre-1967 lines in the West Bank or give up Israeli-annexed east Jerusalem.

If Gaza stabilizes, Israel could argue that Palestinians already have a state there and face less international pressure to negotiate a broader peace deal. The Trump administration promised to try to revive statehood negotiations, but expectations are low and there’s no sign the U.S. found a way to break the long-standing diplomatic impasse.