Doha, Qatar’s capital. The breach between Qatar and its Persian Gulf allies could hamper U.S. actions in the region. (Naseem Zeitoon/Reuters)

The tiny nation of Qatar is defiantly weathering a boycott by four of its neighbors in a deepening crisis that has roiled the region and threatened U.S. interests.

Saudi Arabia, the United Arab Emirates, Bahrain and Egypt severd ties and imposed an economic blockade on Qatar in early June, accusing it of backing terrorism. Qatar has denied the allegations and has since gone on the offensive.

Two months into the isolation campaign, the energy-rich Persian Gulf nation has used its billions to strengthen its economy and security. It has announced reforms and bolstered ties with Turkey and Iran that could potentially reshape the region and its alliances for years.

Efforts by the United States to mediate between its close allies have not succeeded. Instead, the crisis is acrimoniously playing out in diplomatic and legal venues.

“It’s now personal, which in some ways makes it more difficult to find a way for both sides to step down,” said Perry Cammack, a Middle East analyst at the Carnegie Endowment for International Peace. “This is likely to fester for some time.”

The bloc, led by Saudi Arabia and the UAE, has long been at odds with Qatar over its ties to Iran and support for the Muslim Brotherhood, a moderate Islamist group that governments of the bloc view as a threat to their rule. The countries pulled out their ambassadors, ordered citizens to leave Qatar, closed their borders, and shut air and sea routes to Qatari flights and vessels.

President Trump jumped into the crisis with a tweet taking credit for the bloc’s decision to sanction Qatar. But senior State Department and Pentagon officials have tried to defuse tensions — not least because Qatar is home to 10,000 U.S. military personnel at Al Udeid Air Base, the main staging area for U.S. air operations against the Islamic State in Iraq and Syria.

In June, the bloc made 13 demands of Qatar, including that it slash ties with Iran, sever links with the Muslim Brotherhood, expel several Islamists and make reparation payments.

In particular, the bloc has demanded that Qatar shutter Al Jazeera, a Doha-funded media network that has covered the region and its governments critically. Saudi Arabia and its allies view the network, which insists it operates independently, as a mouthpiece for Islamists backed by Qatar.

The countries have blocked Al Jazeera’s website and shut down its offices; Israel announced over the weekend its intention to close down the network’s offices and ban its journalists.

Qatari officials dismissed the demands as “neither actionable or reasonable.”

Instead, Qatar — one of the top producers of natural gas — has sought to diversify its economy and wean itself off its dependence on its gulf neighbors for food and other supplies. Food from Saudi Arabia and the UAE that once filled supermarkets in Qatar has been replaced by products from Turkey and Iran.

Last week, Qatar signed a $262 million deal to bring one of soccer’s biggest stars, Neymar, to Paris Saint-Germain, the nation’s most prominent sports asset. The astronomical sum was widely seen as a good investment ahead of the 2022 World Cup, which Qatar is scheduled to host, as well as a public relations boost.

Qatar also unveiled a draft law last week that would allow some foreigners to acquire permanent residency. For the first time, they will have access to free health care and government-run education, and will be able to own land and operate some businesses without a Qatari partner, according to the country’s state-run news agency.

If enacted, such rights would be unprecedented in the Persian Gulf: Countries rely heavily on a foreign workforce but rarely grant foreigners citizenship or privileges afforded to their nationals. Foreigners make up nearly 90 percent of Qatar’s population of 2.7 million.

The draft law also gives permanent residency to the children of Qatari mothers and non-Qatari fathers. Under current laws in Qatar and other gulf countries, children take the citizenship of their father.

The measure is widely seen as a way for Qatar to thwart the economic blockade by providing incentives for its workforce to stay while attracting more investors and companies to choose Doha, its capital, as a regional business hub.

“One reason is they fear they can lose a significant number of people, especially foreign workers, because of the crisis,” said Anthony Cordesman, a Middle East analyst at the Center for Strategic and International Studies. “The other side is that they are sending a signal to the West, and to others outside, that Qatar is more modern and more willing to seek reform.”

Qatar has aggressively fought the boycott by filing complaints with the U.N. Security Council and the World Trade Organization. It has urged the International Civil Aviation Organization, the U.N. aviation body, to look into whether Saudi Arabia and its allies violated an air travel treaty by banning Qatari flights from their airspace.

Qatar also is strengthening its ties with the West to counter the loss of its former gulf allies. Last week, it announced the $6 billion purchase of seven Italian warships, and in June, it bought $12 billion worth of F-15 fighter jets from the United States.

And over the weekend, Turkey and Qatar staged joint military exercises, the latest sign of their burgeoning alliance. In June, Turkey green­lighted a plan to send several thousand troops to a Turkish base in Qatar, ostensibly to support anti-terrorism efforts. Shutting down that base is one of the demands of the anti-Qatar bloc to lift the blockade.

As the crisis drags on, U.S. officials are increasingly concerned the diplomatic row could hamper efforts to fight the Islamic State in Iraq and Syria. All sides are part of the U.S.-allied coalition fighting the militants.

“The longer this goes on, the harder it is, even if you get an agreement, to get anyone to trust anybody,” Cordesman said.

Correction: A previous version of this story gave an incorrect name for the Center for Strategic and International Studies. The story has been updated.

Read more: