Ayman Abu Odeh, who lives in Gaza, once had high hopes for Hamas. Like many Palestinians, the 50-year-old voted for the militant group and political party in the historic January 2006 election, out of protest more than ideology: Fatah, the secular faction that had dominated politics in the Palestinian territories for four decades, had become deeply corrupt, and a decade of negotiations with Israel had failed to produce a Palestinian state.

Life was comfortable enough before Hamas took control of Gaza in 2007 after a violent, six-day power struggle with Fatah. Abu Odeh used to own a cement mixer and made a good living in Gaza’s construction industry—good enough to build a three-story house in the northeastern city of Beit Hanoun. By the end of 2006, the cement mixer was gone, destroyed during an Israeli army incursion that followed Hamas’ capture of the soldier Gilad Shalit, who was released in 2011 in a prisoner exchange. Abu Odeh scraped out a living for a while as a laborer, but that work eventually dried up, and he now relies on charity. His two adult sons are both unemployed.

Abu Odeh’s house survived until the most recent war, in the summer of 2014. Then an Israeli shell demolished that, too. His family spent the following winter in an uninsulated trailer donated by the Moroccan government—“like living in a freezer,” he called it. His sister’s family lives next door, in the two rooms of their home that survived the blast. They sleep on mattresses in the kitchen and worry that the gnarled structure above them will collapse. Electricity is out for most of the day; water comes by truck every third day. “If you miss it, you’re thirsty,” he said.

Almost everyone in Gaza has a similar story. There was the woman at the Rafah border whose kidneys failed as she waited 15 months to cross into Egypt for medical treatment. Or the businessman who fired 80 percent of the staff at his factory because a military blockade barred him from exporting furniture. Or the father of four who lost track of a daughter during a panicked rush to safety and had to wait a week before he could gather her remains on a plastic tarp.

Residents blame Israel, Egypt, the West, the United Nations. Lately, however, they have become increasingly bold about blaming Hamas. “This government is a failure. We haven’t received a single shekel from anyone,” Abu Odeh began, before his wife interrupted: “You can’t blame our own people!”

She went inside to fetch tea, and he leaned forward. “They start wars they cannot win. We can’t survive another war,” he said angrily. “I swear, I don’t care anymore if the Jews control Gaza. I just want to live.”

Hamas is becoming increasingly unpopular in Gaza—yet in a testament to the decrepit state of Palestinian politics, its rule has never been more secure. In June 2015, Mahmoud Abbas, the Palestinian president, scrapped a unity pact that was meant to give him control of the strip and reconcile Fatah and Hamas; subsequent efforts to reconcile the split between the factions have yielded no progress. There remains no viable domestic opposition.

“It’s a testament to how badly the Israeli policy has failed,” said Sari Bashi, an official with Human Rights Watch and a co-founder of Gisha, an Israeli organization that documents restrictions on Gaza. “Hamas has no friends left, except maybe Qatar and Turkey, and yet their rule in Gaza is totally entrenched.”

And so, after a full decade of governance and three wars, Hamas and Israel have adopted a newfound pragmatism toward each other. Hamas’ leaders now speak optimistically about a “comprehensive agreement” with their sworn enemy, a long-term truce that recently seemed within reach. There are reports that Hamas is considering a major revision to its 1988 founding charter—one that would, for the first time, accept a Palestinian state along the 1967 borders. On the Israeli side, a top army general, Sami Turgeman, has spoken openly of “common interests” with Hamas. And the two sides seem to tacitly cooperate to keep the peace in the besieged strip.

In February, Hamas elected Yehya Sinwar as its leader in Gaza. Analysts quickly began to speculate that the military commander, who spent more than two decades in an Israeli prison, would steer the group into a confrontation with Israel. Sinwar, 55, was released in the 2011 Shalit deal. After joining Hamas, he quickly rose up the ranks of its armed wing, the Qassam Brigades.

Considered a terrorist by the United States, Sinwar has shied away from the media, opting to keep a low profile, and Israeli observers believe his more hard-line approach will mean rejecting the current détente. However, as Eyal Zisser, a Middle East expert at Tel Aviv University, noted in the daily Israel Hayom, “Despite Sinwar’s hostility toward Israel . . . he was the one who signed off on the de facto cease-fire that has existed between Hamas and Israel for the past two years, and he is the one who has preserved the quiet along the border.”

If these trends continue, it would be a remarkable transition, giving Hamas a veneer of legitimacy as the ruler in Gaza. The question is whether Hamas can stay on course. The group itself is divided, with its moderate Politburo increasingly overshadowed by a hard-line military wing. Officials in Ramallah are furious: they fear a deal with Israel would erode their position as the sole negotiators on behalf of the Palestinian people. And Hamas has already been targeted by radical factions—small, shadowy Salafi groups—angry that it has abided by the 2014 cease-fire. They want the fighting to continue, and they regularly lob rockets at Israel, hoping to provoke a response.

Hamas’ dilemma, much like the one Fatah faced in the 1990s, centers on a fundamental question: What happens when a resistance movement stops resisting and starts governing? Hamas has had almost a decade to answer this question, and in October 2016 it came very close. For the first time since it took over the Gaza Strip in 2007, local elections were scheduled to be held across the West Bank and Gaza, with Hamas due to participate in both. But the elections were scrapped after the annulment of Fatah-affiliated candidate lists in Gaza and the harassment of Hamas members in the West Bank.

The cancellation came as little surprise to pundits and observers, especially after Abbas had instructed the legislature to look for “serious irregularities” in the electoral process, according to a report by Al-Quds, the most widely read Palestinian daily. And just recently, the Palestinian Authority (PA) announced it would hold these elections in the West Bank only—for the second time since 2012—much to the ire of Hamas.

AN UNDERSTANDING WITH ISRAEL

Israel has always had a complicated relationship with Hamas. In July 2014, as war raged in the south, a senior Israeli official invited a few journalists to the Defense Ministry, the Kirya, a towering structure in the heart of Tel Aviv. The official, who used to serve as a military commander in Gaza, reminisced about his meetings with “Sheikh Ahmed”—or Ahmed Yassin, the wheelchair-bound co-founder of Hamas who was eventually assassinated by an Israeli helicopter gunship in 2004. “He hated us, we could tell, but he met with us,” said the official.

By the time Hamas was founded in 1987, its leaders had spent two decades diligently building a network of schools and charities across the West Bank and Gaza. They did so with Israel’s blessing: the Islamists were seen as peaceful, more interested in charitable work than in fighting. They were thus a useful counterweight to secular militant groups such as Fatah. “There are experts who’ve argued that Hamas is an Israeli initiative,” the official explained, “and to be honest, this is partially right, because there was a rivalry between Fatah and Hamas.”

The group, an offshoot of the Muslim Brotherhood, was an appealing alternative for many Palestinians as well. It was a religious answer to the godless factions of the Palestine Liberation Organization, and it remained ideologically rigid. In 1988, with the first intifada under way, PLO Chairman Yasir Arafat went to the United Nations and accepted Resolution 181, which partitioned the land into a Jewish state and a Palestinian one. His decision paved the way for secret talks with Israel and eventually for a peace deal between the two. The international community embraced Arafat and the PLO. It was a contentious decision that contributed to the wider split of the Palestinian polity. “Hamas mainly benefited from Fatah’s and the PLO’s shift from a national liberation movement to a governing authority, and their abandonment of resistance as a guiding principle,” said Hani al-Masri, a Palestinian political analyst who closely monitors Islamist groups.

Hamas, much to Israel’s surprise and dismay, quickly picked up the mantle. It sent its first suicide bomber to Israel in 1993 and killed dozens during sporadic attacks throughout the decade. The violence grew much worse during the second intifada, when Hamas was responsible for some of the bloodiest attacks by Palestinian groups, including a 2002 suicide bombing that killed 30 civilians at a Passover seder in Netanya, a coastal city north of Tel Aviv.

Israel launched its own aggressive military campaign against Hamas in the early 1990s. The group’s chief bomb maker was assassinated in 1996 by a booby-trapped mobile phone. In 2002, Israel killed the leader of the military wing by dropping a bomb on a residential Gaza City building. The strike also killed his wife and 11 others, including seven children. Abdel Aziz al-Rantisi, a co-founder of the group, was assassinated less than a month later.

All of this left a deep impression on Khaled Meshaal, the leader of Hamas’ Politburo, who was left to ponder how Hamas could survive without its figureheads. Meshaal himself had been targeted in an amateurish 1997 plot that quickly became a low point in the history of the Mossad, Israel’s intelligence agency. Two agents entered Jordan with fake Canadian passports and injected him with poison outside his office in Amman. They were quickly arrested, and the late King Hussein threatened to cancel the three-year-old peace agreement with Israel if the Hamas chief died. U.S. President Bill Clinton forced Israeli Prime Minister Benjamin Netanyahu to dispatch his Mossad chief to Jordan with an antidote; Yassin was released from Israeli custody in exchange for the two detained operatives.

According to Shlomi Eldar, a veteran Israeli journalist who covered Gaza for more than a decade, Meshaal sent a letter in 2004 to then Prime Minister Ariel Sharon via Omar Suleiman, the late Egyptian spy chief. “Meshaal wrote in his letter, ‘If Israel stops the assassination of the political leadership, they will stop the suicide bombings in Israel,’” Eldar said. “It was not a contract, but an understanding between the two sides.”

The understanding held: by the end of 2004, Hamas had stopped sending suicide bombers into Israel. It continued to fire rockets and staged several operations at the crossings between Gaza and Israel, but it halted the deadliest attacks.

“During the second intifada, their fan base grew and they had an opportunity to go forward. And to go forward, they had to become a political movement,” said Eldar, who has written two books about Hamas. “They needed to find a way between resistance and reality. The reality is, Israel exists, Israel is a strong country; they have to compromise.”

Beit Hanoun town in the northern Gaza Strip, September 7, 2014. Mohammed Salem / Reuters

THE TRANSITION

Things started to change in 2006, when Palestinians went to the polls to choose a new legislature for only the second time in their history.

The first election, a decade earlier, presented Hamas with a dilemma that has defined much of its existence: to join a governing body or to stay on the fringes and lead the “resistance.” The group chose the latter, because participating would legitimize the PA and the political system created by the Oslo Peace Accords, which it so vehemently opposed. Instead it would keep attacking Israel, which not only won over disenchanted Palestinians but also weakened the PA itself. Israel held the authority responsible for keeping the peace and often retaliated against its institutions.

But Hamas’ thinking changed in 2000 after the Camp David summit, the Clinton administration’s last push for peace. The United States and Israel blamed Arafat for rejecting an offer that they called the most generous ever made to the Palestinians. Hamas took the opposite view: Arafat’s very presence at the summit was a problem, bringing the Palestinians too close to concessions. Hamas thus decided to run in parliamentary elections, citing the need to “protect the resistance.”

“As a party of this magnitude . . . we couldn’t stay on the sidelines anymore,” said Sheikh Hassan Yousef, a West Bank–based Hamas founder who is currently held in Israeli administrative detention without charge. “We had to become part of the Palestinian political reality. Our program became comprehensive and it included resistance, alongside the provision of services and creation of institutions.”

They would have to wait six years for a chance. Despite the détente, Israel was reluctant to allow legislative elections, fearing that Hamas would perform well. Those were idealistic days, though, when the White House believed in “democracy promotion” across the Middle East. The administration of U.S. President George W. Bush leaned on Sharon, who acquiesced (then suffered a stroke and fell into a coma less than three weeks before the vote).

The results of the election were an earthquake. Hamas won only a narrow plurality, with 44 percent of the vote to Fatah’s 41 percent—but in the Palestinian electoral system, that yielded 74 seats in the 132-member legislature, a solid majority. The days of one-party rule were over. A group that had never run before, and had wanted to make a more gradual entry into governance, was suddenly in charge. Mahmoud al-Zahar, one of the group’s senior leaders, laid out an ambitious program, vowing to “change every aspect, as regards the economy, industry, agriculture, social aid, health, administration, [and] education.”

Viewed a decade later, Zahar’s language sounds hopelessly naive. Israel and Egypt responded to the takeover by imposing a military blockade on the strip. The Israeli army justified it on security grounds, but the siege was clearly punitive in nature: za’atar (an herbal blend that is a staple of Levantine kitchens), for example, was allowed into Gaza, while other spices such as cumin and coriander were banned; chocolate was forbidden. At one point the army actually calculated the number of calories needed in Gaza to avoid starvation (2,300 per person per day, according to documents revealed by court order in 2012).

Hamas found no support from the West, which designated it a terrorist organization. U.S. and European donors continued to pump millions of dollars into the PA’s coffers, but almost none of that money found its way to Gaza.

The group tried to win hearts and minds by taking a middle course: providing services as best it could, while keeping up the façade of resistance and blaming setbacks on Israel and Fatah. But with no money coming in and the borders blocked, Hamas had no way to deliver on its lofty promises. They quickly rang hollow as power outages became the norm and generators, low on fuel, were unable to pump or treat sewage. The leaders struggled to retain whatever support they had left from resentful Palestinians.

“When we decided to be a governing body, it was not an alternative to resistance,” Yousef said. “Governance is a part of any Islamic movement’s work, and we stress that resistance was never forgotten or sidelined as a result.”

Hamas has been true to its word, at least on the governing aspect. Its decision to take part in the October 2016 local elections, which the PA postponed to May 2017, exacerbated an already fragile relationship with Fatah. In the weeks leading up to the October 2016 elections, the parties accused each other of arresting activists in a bid to affect the results, and Fatah members in Gaza were even banned from campaigning.

In Gaza, party members campaigned on a platform that created a wider chasm with Fatah. “Vote for us, because we are pious, and not for the infidels,” they said, touting their imposition of religious codes upon civic life in Gaza as an achievement and portraying Fatah as a godless party whose setbacks were linked to its secular platform. Hamas also released several ads in which men were seen holding banners reading, “We no longer have any bars or nightclubs,” and, “We have more mosques filled with people.”

Hamas had successfully used this tactic in the past: it has excelled in ballots for student councils at Palestinian universities. The Hamas-affiliated Islamic Bloc won the last two elections at Birzeit University, often seen as a bellwether for national politics. “The PA’s actions have affected the popularity of Fatah,” said Esmat Mansour, a Ramallah-based political analyst. “Everything from the security coordination with Israel to the PA’s crackdown on teachers calling for better wages has boosted Hamas’ credibility. And Hamas has also done a good job of convincing people of its own merits.”

AN INEVITABLE SPLIT

Conflict with Israel became not just an ideological imperative for Hamas but also a practical one. Every time the group’s popularity reached a nadir, another war gave it a short-lived boost at Fatah’s expense.

In June 2014, shortly before the war, Mahmoud Abbas polled at 53 percent in a hypothetical presidential election, against 41 percent for Ismail Haniyeh, Hamas’ then political leader in Gaza. Three months later, after the cease-fire, Haniyeh maintained a lead of 61 to 32. (Neither man is particularly well liked. Both would lose a hypothetical election against Marwan Barghouti, considered a leader of the first and second intifadas, who is serving multiple life sentences in an Israeli prison.)

Abbas was hit particularly hard in the West Bank, where the first postwar poll found a 41-point gap between him and Haniyeh. Fatah was seen as standing on the sidelines while Hamas fought on behalf of the Palestinians. T-shirts with the masked face of Abu Obeida, the Hamas military spokesman, became popular items in Ramallah and East Jerusalem. There was even a rare rally by Hamas supporters on Abbas’ home turf, without interference from the PA security forces.

Hamas’ popularity has historically been a source of worry for Fatah. As far back as the 1990s, Arafat tried to include the group in the PLO—an effort to control it. They held talks as early as 1993, when they met in Khartoum under the auspices of Hassan al-Turabi, the spiritual leader of Sudan’s Islamist movement. Hamas offered to join the PLO, but only if Arafat agreed to two conditions that he could not possibly accept: granting Hamas 40 percent of the Palestinian Legislative Council; and making structural changes to ensure the group a leading role within the PLO.

“What’s always hindered Hamas’ inclusion in the PLO is its refusal to be in the minority or be subordinate to Fatah’s leadership and the PLO’s political agenda,” Masri said. “Fatah wants Hamas to be . . . an auxiliary party that doesn’t affect its sovereignty, but lends credence to its claim that it represents all Palestinians.”

During the early 1990s, when Hamas began its first wave of suicide bombings, the PA came under external pressure to rein in the group. It began jailing Hamas members, which helped the group present itself as an underdog. “Part of Hamas’ popularity had more to do with people’s anger at what Fatah had ultimately become and less to do with believing in Hamas’ principles,” Masri said. “The PA model was far from exemplary. It was riddled with nepotism, corruption, and security coordination with the Israeli military. These paved the way for Hamas, which was branding itself as a resistance group fighting for ‘change and reform.’”

In 2005, when it became clear that Hamas would make its first foray into democratic politics, Abbas took several steps to ensure it would not make significant gains. He postponed the elections, originally slated for the previous July, on procedural grounds; Fatah lawmakers introduced new legislation that increased the number of seats in Parliament from 88 to 132.

Despite these measures, Hamas secured a shocking victory. Abbas had wanted the group to be an engaged player, not a dominant one, and hoped that he could control Hamas, maybe even disarm it, once it became part of the PA. But it proved far stronger than anyone had predicted. All of this set the stage for the inevitable split after the elections. Mediators have spent years since trying to bridge the gap. The two factions signed a reconciliation accord in Cairo in 2011, then another one the following year in the Qatari capital of Doha. Neither was ever fully implemented.

In April 2014, the leaders of Hamas and Fatah took their boldest step, agreeing to form a sort of unity government. A nine-month round of U.S.-brokered peace talks had collapsed after Israel refused to honor the fourth phase of an agreed-upon prisoner release, so the PA turned to sorting out its internal problems, hoping to present a united Palestinian front to the world. Haniyeh resigned his post as Gaza’s prime minister, putting both territories under the nominal control of Rami Hamdallah, the premier in the West Bank. Abbas appointed a single cabinet composed largely of technocrats, men unaffiliated with either movement.

It was a promising enough start. But the deal also required Hamas to relinquish control of the security forces in Gaza and of the border crossings with Israel and Egypt. It did neither. Abbas, for his part, refused to meet his obligation to pay salaries for tens of thousands of civil servants in Gaza, plunging the strip’s economy into further decline. Ministers from the West Bank made a few token trips to Gaza but had little authority to do anything. “They didn’t take this seriously,” said Moufid al-Hasayneh, who was the Gaza-based housing minister in the unity cabinet.

The agreement ended in farce. A delegation of ministers sent to Gaza concluded its visit after just 24 hours, saying Hamas had placed them under “house arrest” in their luxury seaside hotel. After a few more weeks of stagnation, Abbas fired his cabinet of technocrats. Instead he elevated more loyalists to prominent positions—reinforcing his power base in the West Bank, a tacit acknowledgment that he could not retake control of Gaza.

Hamas militants march during an anti-Israel rally in Gaza City, July 8, 2015. Suhaib Salem / Reuters

WAR AND PEACE

Diplomats have long floated the idea of a hudna, a long-term cease-fire, between Israel and Hamas. Meshaal himself proposed it to former U.S. President Jimmy Carter back in 2008, but only if Israel withdrew to its pre-1967 borders, a demand Israel would never accept without a comprehensive agreement. Expectations were low when Robert Serry, then the UN envoy for the Middle East peace process, suggested it again to the Hamas leadership after the last war ended.

Yet this time he found a receptive audience—on both sides. The war was ruinous for Gaza, and the cease-fire that ended it brought few real concessions. But it also hurt Israel far more than officials in Jerusalem admit: 66 soldiers were killed, and Israel’s international image suffered from seven weeks of war that left more than 2,000 Palestinians dead, according to UN estimates, a quarter of them children. Both sides drew blood, and neither was particularly eager to do so again.

“We don’t want another war,” said Fawzi Barhoum, a spokesman and senior member of Hamas. “We want the siege lifted. . . . Gaza is completely destroyed, and we need a comprehensive program that improves the lives of the Palestinian people.”

Since the 2014 cease-fire, Hamas and Israel have intermittently discussed a hudna through European and Arab mediators. Hamas officials say the most likely time frame would be five years, in which the major militant factions in Gaza would pledge not to undertake any operations. In return, they want a major easing of the blockade and to have their own airport and seaport. The former demand is a nonstarter, but the latter is a possibility—perhaps in the form of a “floating seaport” anchored offshore, where an international force would check goods and passengers before they entered Gaza.

“Israel is ready to live with Hamas in Gaza, just not with the ability to reinforce its forces again,” said an Israeli defense official. Yisrael Katz, the Israeli transportation minister, has been a major proponent of the idea, which he describes in rather striking terms. “In an absurd way, we are giving Hamas the keys to the world’s largest prison,” he told the Associated Press in a recent interview.

The Israeli army, meanwhile, has taken a number of small steps over the past three years to ease the economic situation. Gazan farmers have been allowed to sell limited amounts of produce in the West Bank and Israel; textile and furniture factories are allowed to export their goods as well. Throughout 2015 and 2016, the Erez Crossing between Gaza and Israel was busier than it had been in years: more than 13,000 Palestinians exited that way each month in the first half of 2016, compared with fewer than 2,000 during the same months in 2010. (The numbers have since fallen off sharply, a drop that many analysts attribute to the hawkish new Israeli defense minister, Avigdor Lieberman.)

To be sure, these pilot programs barely make a dent in easing Gaza’s economic woes, and businessmen are reluctant to invest much in the region because the situation is so unstable. Erez used to handle 780,000 travelers a month before Hamas took power. Strawberry exports were quickly banned again after Israeli farmers complained about their prices being undercut. The furniture industry is unlikely to thrive in a place where wood imports are heavily restricted. And a truce to resolve all this would require Hamas’ political buy-in, a tough sell with Netanyahu’s right-wing government.

Still, there are signs that the army wants a change of policy in Gaza. Benny Gantz, a former Israeli army chief, told Haaretz in October2014 that the blockade should be lifted. “These people need to live,” he said.

Perhaps more remarkable, many prominent media figures are pushing for a change. Roni Daniel, the military correspondent for Israel’s Channel 2 news show, is infamous for his wartime rants about how the army is being too soft on Hamas or Hezbollah. But he also often acts as a mouthpiece for the army, and during one 2015 panel discussion he delivered a clear message. “The time has come for Israel to take the lead in rebuilding Gaza,” he said, insisting that people there be allowed to work and develop industries.

There is dissent on the Palestinian side as well. Hamas officials have issued wildly divergent statements on the truce: whether it would be five years or ten, whether it would be a written agreement or simply an understanding, and even whether it is being negotiated at all. The military wing of Hamas is skeptical of the idea, but it is giving the political branch time to try—which also gives it breathing room to rearm. Diplomats familiar with the talks, though, say the group is taking it seriously. “The Hamas people see no future,” said a senior UN official in Gaza. “They’re put in this jail with the other citizens of Gaza with no hope. So I think they’ve reached the conclusion that they can’t get what they want by fighting.”

NEW RESISTANCE

There is a deeper problem, though: Hamas and Israel would not be the only parties to a truce. Fatah fears that a hudna would further cement the divide between the West Bank and Gaza. The PLO’s legitimacy rests on its status as the sole negotiator on behalf of Palestinians: if Hamas signs a separate pact with Israel, that role is undermined. “Netanyahu is intent on the continuation of the split,” said Fayez Abu Eita, a Fatah official in Gaza. “He is interested in keeping Hamas in Gaza, without reaching any deal, any political deal, with the PA.”

Indeed, an article published on Al-Resalah, a media website affiliated with Hamas, sought to present Abbas as an obstinate outsider. “[He] no longer holds a political monopoly on Palestinian decisions,” it said. “Abbas is truly afraid of the success of Hamas’ negotiations, despite the failure of negotiations conducted by the PA for more than two decades.”

Then there is Abu Ibrahim, a militant from the Islamic Jihad Movement in Palestine (PIJ) who narrowly escaped death last summer. He ditched his mobile phone during the war, suspecting that Israel was monitoring him. They tracked him instead via relatives and blew up his house in northern Gaza in August, shortly after he’d stopped by for a visit.

He explained all of this, he said, to establish his bona fides as someone committed to the “resistance.” Then he delivered a stinging assessment of the “resistance” group that rules Gaza. “[People] have started doubting the leadership of the parties, because Hamas and Fatah are both stuck to their chairs,” he said over coffee in his brother’s courtyard. “Hamas is behaving like Fatah. They issue studies and statements and decisions, but they never actually do anything to give us freedom.”

The relationship between Hamas and PIJ has always alternated between rivalry and cooperation. They share common interests and ideology, locking them into a perpetual competition for popular support. Tensions deepened after Hamas took power in Gaza; as a governing entity, it was sometimes forced to restrain its more militant rival. “Hamas’ relationship with [Islamic] Jihad is not easy,” Eldar said, calling it a “delicate dance” that requires convincing PIJ that halting rocket fire is in the Palestinian national interest.

The two groups have grown closer since the war. But a long-term truce would change that: ironically, it would re-create the Fatah-Hamas dynamic from the 1990s, allowing Islamic Jihad to stake a claim as the leading “resistance” movement.

Asked about the hudna proposal, Khaled al-Batsh, a leading member of PIJ, dismissed it as a “temporary solution that would not advance the Palestinian cause.” Then he switched to English to make his point more vividly. “Robert Serry is like a pill of morphine,” he said with a laugh. “It’s like we have cancer, and they can’t cure it, so they tell us, ‘Just take one pill of Robert Serry, and you’ll feel better.’”

Yet he also acknowledged that Islamic Jihad cannot buck popular opinion: if the truce brings tangible benefits to the long-suffering people of Gaza, Batsh admitted, his organization would not stand against it.

Some of its members might, however. Hamas has long struggled to control extremist groups within the strip, which see it as both too secular and too soft on Israel. These ultraconservative Salafi groups used to bomb Internet cafés, video shops, and other “immoral” establishments. In 2007 the Doghmush clan, which ran the Army of Islam, kidnapped the BBC reporter Alan Johnston, and it took Hamas four months to secure his release. Violence peaked in August 2009 when an al Qaeda–linked group called for the establishment of an Islamist emirate in the southern city of Rafah. Hamas gunmen stormed its mosque, killing its leader and nearly two dozen other people. Other groups quickly went underground. Since then, there has otherwise been little internal violence.

Lately, though, amid difficult living conditions and public frustration with Hamas, a batch of new Salafi groups has emerged, some of them loosely aligned with the Islamic State (also known as ISIS). They have fired rockets at Israel on at least four occasions, bombed the French cultural center in Gaza, assassinated a Hamas security official, and sent death threats to liberal activists. Meanwhile, they have also distributed space heaters and food, chronicling their activities on social media.

A 2015 Pew Research Center poll found that only five percent of Palestinians in Gaza had a favorable view of ISIS. And the new Salafi groups are not finding recruits among Gaza’s mainstream Salafi community, which remains apolitical. Instead they are attracting disgruntled members of Hamas and Islamic Jihad, militants who are angry about the August 2014 cease-fire and the prospect of a longer truce. Younis al-Hunnor, the extremist killed in a Gaza City shootout in 2015, turned out to be a longtime member of the Qassam Brigades.

Hamas has made matters worse by enforcing a brutal crackdown on these groups, either by imprisoning their members or by installing handpicked clerics in Gaza’s mosques to spread an opposing message. The Salafi groups are still small, with a few hundred members, but their numbers are growing as public anger mounts.

“These issues, the siege, the borders, movement, they don’t just affect Hamas, and they cannot only be resolved by Hamas,” said Abu Ibrahim. “We can’t accept a long truce . . . there will be another intifada if that is declared.”

Palestinians look at Hamas militants as they rappel down a building during a military parade marking the first anniversary of the eight-day conflict with Israel, in Gaza City, November 14, 2013. Mohammed Salem / Reuters

A SUNNI SHIFT

Hamas’ relationship with its other neighbor, Egypt, has always been fraught. Hosni Mubarak, the longtime dictator toppled in 2011, kept the Rafah Crossing mostly shut after Hamas took power and told diplomats he was working to end the group’s regime. “Mubarak hates Hamas, and considers them the same as Egypt’s own Muslim Brotherhood, which he sees as his own most dangerous political threat,” the U.S. ambassador to Cairo wrote in a February 2009 cable released by WikiLeaks.

Nonetheless, Mubarak always maintained high-level connections with the group, and his intelligence chief, Omar Suleiman, often helped to mediate between Hamas and Israel. That policy continued during the 18 months of military rule that followed the revolution; Suleiman’s successor, Murad Muwafi, is considered a key figure in the talks that freed captured Israeli soldier Gilad Shalit in October 2011. Both regimes largely looked the other way as smugglers dug a network of tunnels between Gaza and Sinai, a vital lifeline for Gaza’s besieged economy. Construction materials, cars, even Kentucky Fried Chicken—all of it entered Gaza via the underground passages, as did thousands of rockets and mortars.

But after Mohamed Morsi won Egypt’s presidential election in June 2012 with the support of the Muslim Brotherhood, there was a remarkable, albeit fleeting, shift. Hamas became the darling of Egypt. The border became even more porous, allowing more goods into Gaza, although the army kept Rafah closed. Relations were so positive that Hamas held internal elections in Cairo after Meshaal resigned from his Politburo role. The Egyptian capital became the home of a top Hamas leader, Mousa Abu Marzook. Leaders from Turkey, Qatar, and elsewhere in the region visited the coastal enclave, entering via Rafah in unprecedented shows of support.

Just a year later, the coup ended this brief opening for Hamas. The army-led regime, headed by then General and now President Abdel Fattah el-Sisi, that booted Morsi almost immediately began a heavy crackdown on the smuggling tunnels, which had filled both Gaza’s markets and Hamas’ coffers. By at least one account, 80 percent of the tunnels were closed, causing monthly losses of $230 million to Gaza’s economy. Some were blown up. Others were simply flooded with sewage. The army has demolished hundreds of homes along the border to create a “buffer zone” and has started digging a 65-foot-deep trench next to Gaza to prevent the excavation of future tunnels.

Hamas had already fallen out with its traditional patron, Iran, when it refused to back President Bashar al-Assad in the Syrian civil war and Meshaal left Damascus for good in January 2012. The coup left them further isolated, with Morsi in prison and Assad reelected as president in a sham 2014 vote that took place only in government-held areas. Qatar and Turkey continued to provide financial support, but neither could match Iran’s military aid or Egypt’s diplomatic clout.

“The only corridor for Gaza to the world is through Egypt,” said Batsh, the Islamic Jihad leader. “The crisis between Egypt and Hamas has had a big impact on the suffering in Gaza.”

In recent months, Hamas officials have reached out to Tehran, hoping to repair the relationship. But on this, too, the group is divided. Many leading members want to switch sides and join the Sunni axis in the regional cold war. King Salman, the new Saudi monarch, is seen as less hostile to Islamist groups than his predecessor, Abdullah. Hamas quickly congratulated him on ascending the throne, and Meshaal even met with Salman in a two-day visit to the kingdom in 2015. (Saudi Arabia once provided most of the group’s funds: it sided with Hamas around the Gulf War to punish Arafat for backing Iraq’s Baathist leader, Saddam Hussein.)

A shift to the Gulf would also necessitate better ties with Egypt, a linchpin of the Sunni alliance. Here, too, there are recent signs of progress. In the first two months of this year, more than 8,600 Palestinians were able to travel via the Rafah Crossing, compared with just 3,500 during the same period last year. More significant, Egypt has begun allowing goods—everything from cement to seafood—across the border, the first commercial traffic in a decade.

Ironically, Hamas owes much of the credit to its rivals from Islamic Jihad. Unlike Hamas, with its links to the Muslim Brotherhood, Islamic Jihad is seen by Egypt as a trustworthy interlocutor, a group that focuses only on domestic issues. Its leader, Ramadan Shallah, spends a considerable amount of time in Cairo, meeting with officials from the presidency and the intelligence services. “The issues in the relationship will take a long time to fix,” said Daoud Shihab, a spokesman for the group. “But we can’t survive without Egypt.”

A NEW, UNLIKELY ALLY

In late 2013, with public anger mounting in Gaza, a group called Tamarod (“Rebel”)—named after the Egyptian group that helped overthrow Morsi—vowed to rally one million people to a November 11 protest against Hamas.

The protest never took place because Hamas cracked down on the group’s leadership. Still, it remains an important historical footnote: it was the first time a local group voiced public opposition to Hamas’ rule—and it was linked to Mohammed Dahlan, the Fatah leader who once led a brutal crackdown on the group.

Dahlan, a native of the Khan Younis Refugee Camp in Gaza, spent much of the 1980s in Israeli jails, where he learned to speak Hebrew, a skill that would prove useful after his release. Arafat sent him back to Gaza in the 1990s to head the Preventive Security Force—the notorious secret police organization that reported directly to the Palestinian leader. Dahlan built a reputation for both brutality and corruption. The 20,000 men under his command were accused of torturing Hamas detainees, abuses that worsened in 2006 and 2007, particularly during the brief week of infighting that followed Hamas’ electoral victory. Gunmen roamed the streets; members of Hamas were shot or simply disappeared; and at least one was tossed off the roof of a 12-story building. Dahlan himself, meanwhile, allegedly skimmed millions each month off the taxes collected at Karni, one of the commercial crossings with Israel.

After Hamas took power, he was forced out of Gaza, and then the West Bank, where an increasingly paranoid Abbas came to view him as a threat. He has spent most of his exile in Abu Dhabi, cultivating close ties with the royal family and becoming fabulously rich. Many of his business interests are based in Montenegro, where he acquired citizenship in 2010, and he recently received a Serbian passport after steering billions of dollars in Emirati investments to the Balkan country.

Yet this corrupt Fatah strongman has improbably emerged as Hamas’ newest ally in the Gulf. His wife, Jalila, has made several visits to Gaza over the past few years, behaving almost like a first lady. She chats with fishermen on the beach, meets with political officials—and, most important, hands out money. In 2015, the United Arab Emirates transferred $12 million to a Dahlan-run charity, which distributed $5,000 each to families who lost a relative during the 2014 war. Charities linked to the former security boss have financed mass weddings in Gaza, allowing hundreds of poor couples to tie the knot.

In exchange for his financial support, Hamas has given Dahlan a political foothold in Palestine. Three officials confirmed in recent interviews that the group is debating whether to allow him back into the strip. “We are internally studying this to see if it would be beneficial,” said Sami Abu Zuhri, the Hamas spokesman. “Relations with the [Gulf Cooperation Council] and the Arab countries are important.”

Dahlan himself has been Delphic in his public statements. He told Bloomberg that he was not ready to announce a presidential bid, calling it a “suicide mission.” Associates in Gaza do not expect him to make a personal visit soon. Instead he is biding his time, using his deep pockets, cozy relations with security services in Jordan and Egypt, and political connections to rebuild support and to needle the notoriously paranoid Abbas.

AVOIDING ANOTHER WAR

Ghazi Hamad admits that he is not the most influential man in Hamas. The deputy foreign minister sits firmly on the left wing of the moderate political branch and was involved in some of the earliest talks to free Shalit after his capture in 2007.

Still, he published an op-ed in 2015 on several Palestinian websites, including Samaa News, that was remarkable even for someone outside the mainstream. The article, entitled “How and Why Palestine Was Lost,” was a broadside against the entire Palestinian national movement, written after a three-hour meeting with leaders of Hamas and Fatah that left him feeling that the movement was “futile, adrift, insipid.” Both factions were committed to a narrow strategy—Fatah to talking, Hamas to fighting—with no broader vision.

“It is strange that everyone believes they are close to achieving their goals,” he wrote in the op-ed. “Fatah thinks it is just around the corner from a state, and Hamas thinks it is close to the liberation of Palestine.” Even more unusual, Hamad rang up a Tel Aviv radio station to discuss his op-ed and gave Israeli media permission to translate it into Hebrew. Hamad’s words drew little public response in Gaza, but privately some officials admit that he has a point. “The PLO talked with Israel for 25 years, and until now the status of the Palestinian people is a big zero,” said one senior Hamas member in Gaza. “And this talk of a truce, it can’t just be about firing rockets. We must have a clear goal, a complete proposal, not just a few exports and a bigger fishing zone.”

Israeli and Palestinian officials agree that for all its brash statements, Hamas has adopted an increasingly pragmatic approach, although not quite the broad strategy Hamad wants. A hudna will bring humanitarian benefits, and an alliance with the Gulf states could deliver major investment. Neither will create a Palestinian state.

Still, they are necessary steps. The last war with Israel left hundreds of thousands of people in Gaza homeless, and the strip’s 43 percent unemployment rate is the highest in the world. Infrastructure is crumbling, public services are poor, and the water is barely drinkable. The United Nations has said repeatedly that Gaza will be uninhabitable by 2020 without major changes.

If a truce is not signed in the coming months, another war seems inevitable. It will be a different fight. Militants say they will fire fewer rockets at Tel Aviv and Jerusalem. That tactic had propaganda value but did little damage, and long-range weapons have proved hard to resupply. Instead they will bombard communities around Gaza and try to carry off an early high-value attack—raiding a kibbutz or army base, perhaps through a tunnel. They hope to draw Israel into a wider ground war, where the fighting is a bit less unequal and casualties will be higher.

But both sides are trying to avoid another round. Hamas has clamped down hard on the Salafists firing rockets at Israel, arresting them within 24 hours, and every Hamas official interviewed in Gaza stressed his commitment to the August 2014 cease-fire. Turgeman, the former head of the Israeli army’s southern command, said back then that he would not return to war over “a few rockets.”

He also told Israeli mayors that they shared “common interests” with Hamas. After almost a decade of siege and warfare, Turgeman admitted that there was “no alternative to Hamas as the sovereign in Gaza.”

“They are the powers that be,” said Ofer Shelah, an Israeli member of the Knesset who previously served on the Foreign Affairs and Defense Committee. “I wouldn’t say they’re the lesser evil, but we do see them as, well, you don’t know what will happen if Hamas isn’t there.”

The next few months will decide what kind of neighbor Hamas will be. Fatah faced a similar dilemma in the 1990s, when its leadership weighed whether to sign the Oslo Accords. The agreement offered international legitimacy and a chance to return home after decades of exile. It also meant the end of the resistance project with only the promise of a final-status agreement. Not everyone agreed. But Fatah had a strong leader to push it through—Arafat, the man who had come to personify the Palestinian national movement.

Hamas has no such leader. Meshaal is largely irrelevant, ensconced in a comfortable villa in Doha. (He was widely mocked for a 2013 photo shoot that captured him playing Ping-Pong and exercising at a private gym.) The Gaza-based political leadership is marginalized as well. Hamas does not publish the results of its internal elections, but officials say the military wing has taken an outsize role in the Executive Committee, its main decision-making apparatus. Mohammed Deif, the shadowy military commander, is busy preparing for another conflict. Fathi Hamad, a hard-line former interior minister, recently set up his own parallel military wing, the purpose of which is unclear.

Ironically, Hamas finds itself in largely the same position that Arafat’s PLO did in the 1990s. It faced two unpalatable choices: permanent exile and an assassination campaign against its leadership; or survival and self-governance, as long as they adhered to Israeli and Western dictates. The group has also plunged into the same trap that Fatah fell victim to decades earlier—institutionalizing the resistance. By taking on the role of the governing authority, it was forced to prioritize the day-to-day affairs of nearly two million Palestinians, juggling that role while simultaneously keeping up their “resistance.” The political leadership of Hamas is not oblivious to this challenge. In 2012, at a conference in Doha on Islamism and democracy, Meshaal gave a public lecture where he admitted the party’s missteps. Hamas’ experience should be taken not as a model but as lessons learned, he said. “Islamists must admit that ruling is more difficult than they had imagined.”