BEIRUT — Three years after the last war in Gaza, the leaders of Israel and Palestine seem to be lurching toward another round of fighting—although not for the reasons you may think.

On Sunday, the Israeli security cabinet agreed, at the request of the Palestinian president, to reduce the amount of electricity it supplies to the blockaded territory by 40 percent. The officials came to the decision even after top Israeli generals warned it would lead to a humanitarian crisis in the strip, where 1.9 million people are bracing for a scorching summer with perhaps only three hours of power per day. Hamas, the militant Islamist group that controls Gaza, warned of an “explosion.”

Blackouts are not the only issue, however: If there is a fresh round of fighting, it may be sparked by a diplomatic crisis happening some 1,100 miles away—one that both the Israeli defense minister and U.S. President Donald Trump have goaded on.

On June 5, Saudi Arabia and several of its allies decided, with little warning, to blockade Qatar, in an effort to punish the tiny emirate of 2.7 million residents for supporting the wrong groups across the region—namely the Muslim Brotherhood—and to reinforce an alliance against Riyadh’s real nemesis: Iran. There are already signs that the effort may backfire. Turkey has doubled down on ties with Qatar, fast-tracking a bill that allows it to deploy troops there. Iran rushed to establish an air bridge to Doha, flying in shipments of food.

There is, of course, ample reason to criticize Qatar’s role in the region. The emirate has reportedly paid hefty ransoms to al-Qaeda’s affiliate in Syria, and looked the other way as private citizens funneled millions to jihadists across the Middle East. Al Jazeera’s Arabic service, once the boldest news channel in the area, has degenerated into a sort of propaganda outlet for Sunni Islamists, peddling conspiracy theories and sectarian vitriol about Christians in Egypt, Alawites in Syria, and other groups.

But all this hardly begins to explain this region’s fraught politics. For all the talk of brotherly unity, the six-member Gulf Cooperation Council is a dysfunctional, divided alliance. Saudi Arabia tries to set the tone: It is larger than the other five members of the council, combined, and draws diplomatic and religious clout from its custodianship of the holy sites in Mecca and Medina. Its main fear is Iran, followed by political Islam.

Several of Saudi Arabia’s neighbors feel differently. The first tentative steps toward the 2015 nuclear deal between Iran and several world powers took place in Oman, where the sultan hosted secret talks between American and Iranian officials at a seaside villa. Oman has also declined to take part in the Saudi-led war against Houthi rebels in Yemen, which has decimated the poorest country on the Arabian Peninsula, with a looming famine and a recent cholera outbreak. Kuwait, with an Islamist-dominated parliament and a large ethnic-Iranian minority, often prefers to mediate regional disputes, rather than join them.

There are even budding tensions between Saudi Arabia and the United Arab Emirates, its closest ideological ally in the Gulf. The Emiratis have deployed thousands of troops to the south of Yemen, trained up a 30,000-man Yemeni militia, and spent about $2 billion to support Yemen’s battered economy. On the northern front, the Saudis have mostly fought from the air, and they have little to show for it. Militias backed by the two sides engaged in a firefight earlier this year during a battle for control of the airport in Aden.

The case of Hamas is yet another marker of the complexity of this crisis. In recent years, the group has struck an uneasy balance between Saudi Arabia and Iran. While the latter was once Hamas’s biggest patron, supplying it with money and weapons, the two sides parted ways in 2012 when the Palestinians backed the uprising against Bashar al-Assad’s regime in Syria. Soon, Tehran, which backs the Assad regime, cut off military aid to Hamas. The former leader of Hamas, Khaled Meshaal, was forced to leave his longtime base in Damascus, decamping for Doha, where the group received an enthusiastic welcome.

Since then, Meshaal has tried to steer Hamas closer to the Gulf states. He met with King Salman on a rare visit to Saudi Arabia in 2015, and pushed back against the leaders of the Qassam Brigades, the military wing of Hamas, who wanted to pivot back to Iran. He thought such a move would empower the comparatively moderate political wing of Hamas, and perhaps win the group a measure of international recognition. Now, though, the Saudis and their allies are demanding that Qatar cut ties with Hamas and expel its leaders from Doha—quite possibly pushing it back towards Iran.

This tension is no mere academic matter. Gaza has been devastated by three wars over the past decade. Even hawkish Israeli politicians agree that the only way to prevent a fourth flare-up is to improve living conditions in the strip. But that won’t happen if Hamas is pushed away from the Gulf and back towards Iran—a shift that would be welcomed by the group’s hardliners, who have advocated it for years. “The Arab states have been abusing the Palestinian cause since the creation of Israel in 1948,” Mahmoud al-Zahar, a co-founder of Hamas, told me. “This is a fixed policy.”

Qatar, by contrast, has been one of the few states to provide consistent support, repairing the main coastal highway and building thousands of new homes for families displaced during the wars. It has also spent tens of millions of dollars on fuel for Gaza’s sole power plant. The exchange of funds is managed by a Qatari official who works in one of Gaza’s upscale, half-empty seaside hotels. A cutback in Qatari aid, then, would worsen the already-dire humanitarian situation in Gaza, where nearly half the population is unemployed and three-quarters depend on aid to survive.

Financial aid from Iran, on the other hand, has been mostly diverted to military projects. Tehran also played a key role in helping Hamas produce rockets domestically, inside Gaza. In 2012, the head of the Revolutionary Guard admitted that his forces taught Hamas how to produce a variant of the Fajr-5, a long-range projectile that has been used to strike the Tel Aviv suburbs. The resumption of Iranian aid would give the Qassam Brigades access to both cash and blueprints. “It’s become much more difficult for [Hamas] to rearm recently,” an Israeli intelligence official told me. “So they’ll be looking for the next big thing.”

The pressure on Hamas might also cause a rupture with Egypt, which has been deeply hostile toward Hamas since President Abdel Fattah el-Sisi seized power in a 2013 coup. He has rightly accused the group of collaborating with the Islamic State branch on Sinai, which controls what little remains of a once-thriving cross-border tunnel trade. “The issues in this relationship go back a long time, and they’ve been hard to fix,” Daoud Shihab, a member of Islamic Jihad, which has helped to mediate between the two sides, told me.

Earlier this year, however, the talks between Egypt and Hamas finally started to bear fruit. Hamas agreed to stop sheltering jihadists, and publicly cut ties with the Muslim Brotherhood. Egypt has allowed some commercial traffic across the Gaza border for the first time in a decade. It should be a win-win for both sides. But boosting the Qassam Brigades, which relies on the smuggling tunnels to import arms, threatens to upset the fragile détente.

The timing of all this could not be worse, with Hamas already under pressure from the electricity crisis. Over the past three months, Mahmoud Abbas, the Palestinian president, has also reduced the salaries paid to tens of thousands of civil servants in Gaza, and suspended shipments of medicine and baby formula to hospitals. The public is seething.

Qatar has already expelled several Hamas officials, including Saleh al-Arouri, a prominent figure from the military wing. Israel accuses him of plotting attacks in the occupied West Bank (a charge his colleagues do not dispute). Sources in Gaza say Hamas pocketed millions by charging families for Qatari-built homes, which were meant to be distributed free of charge. The United States and its allies could press Qatar on these issues—but a complete severance of ties, as the Gulf states have so far demanded, would have dire consequences.

Doha may yet accede to its neighbors’ demands. Israel and its allies would see this as a victory: Avigdor Lieberman, the Israeli defense minister, said the crisis gives Israel new opportunities to work with Arab states; President Trump continues to take credit for starting it. Their optimism may not last.