Dhari Al Jasmi, a Sunni resident of Kuwait City, rechecked his smartphone. Another terrorist organization had bombed another mosque in the Middle East, yet...

Dhari Al Jasmi, a Sunni resident of Kuwait City, rechecked his smartphone. Another terrorist organization had bombed another mosque in the Middle East, yet the victims of this bombing looked different from the Libyan and Yemeni casualties who so often appeared on television.

“When I saw the bombing on Instagram and other social media, I thought about what was happening in Syria or Iraq,” Al Jasmi told me. “Yet when I saw the dress of the victims and the name of the mosque, I was shocked and didn’t believe it.”

Islamic State had achieved what few of Kuwait’s other enemies could since Iraq invaded more than 20 years ago — attack one of most stable countries in the Middle East.

It began on June 26, when Fahd Suleiman Abdulmohsen Al Qabaa entered the Imam Jafar As Sadiq Mosque — named after the sixth imam and a revered Shia leader — in Kuwait City.

Islamic State had urged Sunni Muslims to purge the Arabian Peninsula of Shias, and the terror group had already bombed two Saudi Shia mosques in May.

The suicide bomber positioned himself in the last row of congregants, detonating an explosive belt. The attack occurred on a Friday as Muslims prayed during Ramadan. The timing ensured that the mosque would be as full as possible. The blast killed 18 Kuwaitis, three Iranians, two Indians, one Bedoon, one Pakistani and one Saudi.

A government airplane transported eight of the Kuwaiti dead to Najaf, a Shia holy city in Iraq. The local cemetery, the largest in the world, has become the newest graveyard for civilians and combatants killed as Islamic State attempts to expand throughout the region.

“I gasped in horror when I heard about the bomb attack in Kuwait,” said Ana Grisanti, a student from Boston College who had left Kuwait less than two weeks before the bombing.

“When I got through the shock of how close I could’ve been to the site if it had happened just a few weeks earlier, I started thinking about the friends I had made there over the summer.”

All the monarchies of the Gulf except Oman have large Shia populations. But Kuwait, like the United Arab Emirates and Qatar, seems to avoid the sectarianism of Bahrain and Saudi Arabia, namely in the Shia-majority parts of the Saudi east.

The Kuwaiti government, though Sunni, claims to respect the country’s Shia minority. Shia banker Abdullah As Saleh agreed.

“In Kuwait, Shias and Sunnis are treated equally,” he emailed me.” As Saleh concluded that religious denomination matters less than nationality in his country. “I consider my identity Kuwaiti,” he wrote. “Being Shia is something between the self and the creator of the self [God]. It has nothing to do with identity.”

The news media defended the idea that the bombing had backfired, uniting Shias and Sunnis instead of dividing them.

But Kuwaiti history, which includes more sectarianism and terrorism than many politicians admit, challenges the argument that Kuwait provides what little stability the Middle East can offer.

Kuwait has, unlike other states in the Arab world, rarely intervened in regional politics. Even so, the country’s emir did so during the Iran–Iraq War. Kuwait joined other Arab countries, America, Britain, China, France, Italy and the Soviet Union in supporting Iraq against Iran.

As analyst Matthew Levitt documented in Hezbollah: The Global Footprint of Lebanon’s Party of God, two opportunities emerged for Iran, whose Islamic republic now considered Kuwait an enemy.

Iran deployed the Lebanese terrorist organization Hezbollah to Kuwait City with the short-term goal of punishing Kuwait for supporting Iraq, and the long-term goal of spreading the Iranian Revolution to Kuwaiti Shias. Maybe on purpose but likely by accident, Kuwait had become a combatant in one of Islam’s longest-lasting conflicts.

The attacks depended on foreign experts and operatives, often Iranian-trained Iraqi and Lebanese Shias. Twelve Iranian-directed agents — nine Iraqis and three Lebanese — targeted government and Western buildings throughout Kuwait City in 1983, kickstarting three decades of under-reported terrorism.

In December 1984, four Lebanese hijacked Kuwait Airways flight 221, redirecting it to Tehran. The hijackers targeted American and Kuwaiti passengers. The following May, an Iraqi driver working for Hezbollah tried to assassinate the emir with a car bomb.

In April 1988, a group of Lebanese again hijacked a plane, this time Kuwait Airways Flight 422. The hijackers executed one Kuwaiti and released another to earn sympathy.

“In these attacks,” noted Levitt, “senior Hezbollah operatives, joined by their Iraqi compatriots, acted in the explicit service of Iran rather than in the group’s immediate interests.”

Where Iran tended to rely on local proxies in Bahrain, Iraq, Lebanon and Saudi Arabia, its agents in Kuwait tended to be foreign Arabs. In fact, these agents often transported money and weaponry through Kuwait, and many of Hezbollah’s Bahraini allies lived in Kuwait City. In 1997, the Kuwaiti government arrested 13 Bahrainis and two Iraqis associated with Iran and Hezbollah’s Saudi affiliate.

However, Iran worked to influence Kuwaiti Shias. Hezbollah admitted as much 1992, and Kuwaiti Shias prepared failed attacks throughout 1986 and 1987.

But where Iran and its Shia allies caused Kuwait’s problems with terrorism in the 1980s and 1990s, Sunni militants have dominated attacks in the 2000s and 2010s. Two Kuwaitis killed an American soldier in October 2002. A Kuwaiti police officer shot another two American soldiers that November. A gunman killed an American contractor the following January.

In 2005, Kuwaiti Sunnis formed the Peninsula Lions, a revolutionary group that the Kuwaiti government defeated after a shootout killed six of the group’s members and one police officer. Six Kuwaiti members of Al Qaeda planned to bomb an American military base only for the Kuwaiti government to arrest them in August 2009.

Following the bombing of the Imam Jafar As Sadiq Mosque, Kuwait’s media emphasized that he came from Najd, one of Saudi Arabia’s most-conservative regions, rather than from Kuwait.

But this history of attacks would nonetheless imply that there is no shortage of Sunni militants in the country, and that Islamic State chose a Saudi bomber because a foreigner might be more convenient, not because no Kuwaitis support terrorism.

The International Center for the Study of Radicalization and Political Violence estimated that Islamic State includes 70 Kuwaitis in its ranks. This number is much lower than the 1.5–2.5 thousand Saudis fighting with the terrorist group, yet the ICSR believes only 12 Bahrainis and 15 Qataris to have joined the terrorist organization.

If the estimates are correct, Kuwait has contributed the same number of fighters to Islamic State as Somalia, a country known for importing and exporting extremism, sectarianism and terrorism.

Two of 2015’s most-notorious terrorists, Mohammed Emwazi and Muhsin Al Fadhli, are Kuwaitis. Emwazi has executed Western hostages, so embarrassing the Kuwaiti government that it asked his father to distance himself from Islamic State and started monitoring his family still living in the country.

Al Fadhli led the Khorasan Group, a mysterious, Syrian-based subgroup of Al Qaeda dedicated to attacking Western targets, before an American air strike killed him on July 8. The U.S. State Department observed that the Kuwaiti government wanted to arrest or kill Al Fadhli, one of Al Qaeda’s most influential members.

As Iranian agents in the Gulf used Kuwait to transport money and weaponry during the Iran–Iraq War and its aftermath, Sunni militants have used the country to finance diverse revolutionary movements and terrorist organizations throughout the Muslim world, many involved in the Syrian civil war.

“Everybody knows the money is going through Kuwait and that it’s coming from the Arab Gulf,” Andrew Tabler of the Washington Institute for Near East Policy told The Daily Beast, which commented that Islamic State depends on Kuwaiti donors, even though the country is a stated enemy of the terrorist group. “Kuwait’s banking system and its money changers have long been a huge problem because they are a major conduit for money to extremist groups in Syria and now Iraq.”

The emir has supported Operation Inherent Resolve against Islamic State just as — 30 years ago — his predecessor supported Iraq against Iran. However negligible this support may be, Islamic State noticed, and the opportunities it has foreseen parallel the opportunities that Iran saw only decades ago.

Islamic State can punish Kuwait for supporting the coalition in the short term, and further its anti-Shia ideology in the long term, creating sectarian discord and strife between Kuwait’s Shias and Sunnis.

Kuwaiti Shia businessman Emad Qabazard suggested the relationship between Shias and Sunnis is less cordial than what As Saleh had implied.

“Hezbollah and Iran are telling the world the truth of what’s going on between the U.S. and Israel,” Qabazard said, describing a conspiracy in which America, Israel and America’s Arab allies hoped to spread sectarian conflict in Iraq, Syria and now Kuwait.

“If you look at ISIS’s history, you will find out how it all started,” he told me. “The U.S. and Israel found the weakest link between Sunnis and Shias, then created this war. All this fight is for power and oil and natural gas.”

His conspiracy theory interested me less than his apparent sympathy for Iran and Hezbollah, which brought with it the implication that Iran could still influence Kuwaiti Shias.

“Some Shias believe that Iran and Hezbollah will secure Shias in the Gulf region and help keep ISIS away from them,” As Saleh told me. “From what I see, involving Iran and Hezbollah in the Gulf against ISIS will create another civil war. The major Shias think that Iran and Hezbollah will add to their societies.”

In 2008. the Strategic Studies Institute estimated that as many as 40 percent of Kuwaitis may be Shias, a much larger percentage than in Saudi Arabia. Shias have struggled in the National Assembly. The Popular Action Bloc even expelled two popular Shia politicians for mourning a Hezbollah leader who, in an irony that no one seems to have noticed, might have masterminded the two Kuwait Airways hijackings.

Qabazard added that the Kuwaiti government restricts Shias from joining the Defense and Interior ministries “because the government thinks that [Shias] are giving information to the Iranian government” despite how Kuwaiti Shias defended their country during the Iraqi invasion.

But the Kuwaiti government has far outdone the Bahraini, Iraqi, Saudi, Yemeni and even Lebanese governments in balancing and managing the relationship between Shias and Sunnis.

Defending Kuwait as an example of stability, however, would be naive and simplistic. Its government, though friendly to the Western world, is dictatorial and discriminatory. Dozens of its citizens have funded, joined or otherwise supported Shia and Sunni terrorist organizations.

The emirs have worsened the sectarian problems on which these paramilitaries thrive with haphazard interventions in regional conflicts, the latest in Yemen. Yet it surprises the Kuwaiti government that the Yemeni civil war, another conflict between Shias and Sunnis involving Iran and Hezbollah, may affect Kuwait.

On July 30, the Kuwaiti government arrested five men belonging to a clandestine Islamic State cell. These men, unlike the bomber of the Imam Jafar As Sadiq Mosque, were Kuwaitis.

The bombing was nothing new. It continued a tendency for decades of well-hidden sectarianism and terrorism to recur when Kuwaitis least expect. But when another Shia or Sunni terrorist organization strikes Kuwait City, perhaps the Kuwaiti government will react with less surprise. The emirs have experienced 30 years of it already.

“We must not forget that Kuwait, with its emir, and government, parliament, political and social forces, scholars, Sunnis, Shias, media, and people set forth a brilliant example in dealing with this incident,” Hezbollah chief Hassan Nasrallah said, referring to the June 26 bombing. “If only this example would be followed widely in all Arab and Islamic states.”

But Kuwait is an example of how to hide sectarianism and terrorism, not an example of how to stop it. The claims of Hezbollah — which itself bombed Kuwait in the past — mean little.

“Acts of terrorism are never expected — they are only acted on when an individual or a coalition wills it to be,” said student Evan Cosgrove, who traveled with Grisanti to Kuwait.

“When our group was in Kuwait, we drove past that mosque multiple times. Between museum visits and dewaniyas with locals, you think that a country like Kuwait is unaffected by Islamic extremism. However, just as this mosque bombing proved, no country or group of people are completely free from this idea.”