The US and Qatar have been key allies for decades, with close military and economic ties. Qatar is home to the United States’ biggest base in the region, and in turn the US has pledged to protect the small oil-rich country that juts out into the Persian Gulf.

But the relationship is being tested like never before by the latest example of Qatar snubbing the interests of Uncle Sam – or, put more generously, its maverick foreign policy.

The US recently placed severe sanctions on Turkey’s economy for refusing to release an American pastor detained for almost two years, sparking a currency crisis. Qatar was the first, and so far only, nation to offer Turkey tangible aid in the form of a $15 billion investment and other types of financial assistance.

Although the Gulf country has long pursued policies out of step with the US, such as maintaining good relations with Iran and aiding various groups that the US considers terrorists, its very visible support for Turkey in the dispute poses a direct challenge to the Americans. And while the US has in the past practiced patience with its sometimes wayward ally, President Donald Trump is often willing to toss out the rulebook and has previously lambasted Qatar on Twitter.

As a longtime observer of the region’s complicated economic and political developments, I believe that Qatar’s interjection in the US-Turkey crisis raises two important questions: Why is Qatar willing to risk its close relationship with the US? And why has the US let it get away with this behaviour for so long?

U.S. Defense Secretary Jim Mattis greets military dignitaries at Al Udeid Air Base in Qatar. Photo credit: Jonathan Ernst/Reuters

Punching above its weight

A country of just 320,000 citizens – as well as 2.32 million expatriate residents – Qatar has a habit of using its massive oil and natural gas reserves to exert influence in the Middle East and beyond. Such a hyperactive foreign policy is very unusual for a small state like Qatar.

Qatar made its offer to Turkey during a recent visit by Qatari leader Sheikh Tamim Al Thani to Ankara. The announcement helped stem the rout in the lira, which lost a third of its value in a month. It was followed by a so-called currency swap agreement that will allow Turkey to bypass the US dollar in bilateral trade and financial transactions with Qatar.

While Iran and several Arab countries including Kuwait have expressed opposition to the US sanctions, none so far has offered tangible financial support similar to Qatar’s.

Meanwhile, the US is trying to put economic pressure on Turkey in hopes it spurs the release of the American pastor, who has been detained for nearly two years on allegations he supported the failed July 2016 coup. Qatar’s aid clearly counteracts that pressure.

So far, the US hasn’t publicly reacted to Qatar’s actions.

Allies aiding adversaries

This gesture of support for Turkey is not the first time that Qatar has taken a stand that conflicts with US foreign policy objectives.

On several occasions in the past two decades, the US has expressed concern about Qatar’s support for various Islamist and extremist groups, such as the Muslim Brotherhood, as well as its relations with Iran. In May US officials issued a warning after a newspaper reported evidence of clandestine contacts between Qatar and Iran’s revolutionary guards and other groups it supports.

This behavior may seem puzzling because ever since its creation as an independent state in 1971, Qatar has relied on the United States for its external security.

At the same time, Qatar hosts about 10,000 US military personnel at Al Udeid Air Base, home of the US Air Force Central Command, which is used to conduct operations in Syria, Iraq and elsewhere.

The United States also maintains strong economic relations with Qatar as its largest foreign investor – particularly in oil and natural gas production.

Qatar’s possible rationale

So why would Qatar risk jeopardising the relationship by aiding Turkey so publicly?

One possible explanation is that Turkey itself has become an important strategic and economic partner.

The two signed a military cooperation agreement in 2014, which allowed Turkey to maintain a small base in Qatar. When fellow Gulf Cooperation Council states Saudi Arabia and the United Arab Emirates broke diplomatic relations with Qatar in 2017 and imposed a trade embargo, Turkey increased the number of its troops at the base to deter military action.

This was important to Qatar because the US seemed to be showing more support for Saudi Arabia and the UAE in the standoff, a perception reinforced by highly critical tweets from Trump.

Qatar’s recent expansion of trade with Turkey also helped it survive the embargo as Turkish consumer goods flowed in, leading to a surge in trade between the two countries.

Bilateral investment between Qatar and Turkey has also increased in recent years. Qatar has nearly $20 billion in investments in Turkey, and a large number of Turkish construction firms are active in Qatar.

Another possible explanation is that Qatar’s leaders simply believe that the US needs Qatar more than Qatar needs the Americans. The rationale is that the American military bases there are vital to its ability to project power in the region. Meanwhile, Qatar’s significant reserves of oil and gas make it a valuable economic partner.

As a result, Qatar may believe the US will continue to show a high level of patience, even in the face of support for Turkey.

Things are a bit frostier in the Oval Office with Trump. Credit: Kevin Lamarque/Reuters

US patience running thin?

It is true that the United States has tended to be patient with Qatar’s maverick foreign policy, including over Iran.

But Qatar’s government would be wise to have a realistic understanding of the erratic and unpredictable nature of American foreign policy under the Trump administration. Just as Turkish President Recep Tayyip Erdogan was shocked by Trump’s sudden impositions of harsh sanctions this month, Qatar might also face a similar American reaction for going too far in its support for Turkey, or getting too close to Iran.

In addition, Qatar must keep in mind that Turkey could never replace the U.S. as a partner both in terms of military protection or the advanced American oil and gas technology it receives.

In other words, if Trump is willing to risk the United States’ relationship with Turkey so easily, Qatar should not assume that it is immune from his wrath – or could find as useful an ally. Perhaps a better strategy for Qatar is to maintain a balance between its two important allies.

Nader Habibi, Henry J Leir Professor of Practice in Economics of the Middle East, Brandeis University.

This article first appeared on The Conversation.