This weekend saw the United States and Turkey engage in a tit-for-tat imposition of travel restrictions on each other’s citizens. It was yet another sign of the increasingly strained relationship between Washington and Ankara, two Nato partners who have traditionally kept deep military, intelligence and commercial ties.

The restrictions come despite President Donald Trump’s pledge to restore good relations with Turkey following years of tension under former president Barack Obama. Trump had praised Turkish President Recep Tayyip Erdogan as a “friend of mine” during Erdogan’s visit to the White House last month, saying the two were “now as close as we’ve ever been.” But as his country teeters on the brink of bigger chaos, some analysts suggest that Erdogan may have more to gain by keeping his spat with the United States going.

What is clear is that the diplomatic breakdown has been a long time coming — and it may have a long way to go.

The latest development stems directly from the arrest of Metin Topuz, a Turkish employee at the US Consulate in Istanbul, on charges of espionage last week. On Sunday, the US Embassy in Ankara announced the immediate suspension of all non-immigrant visa services at diplomatic facilities across Turkey. The incident, the embassy said, required the United States to “reassess the commitment of the Government of Turkey to the security of US Mission facilities and personnel.”

Just hours later, the Turkish Embassy in Washington issued a nearly identical statement about the suspension of non-immigrant visas for Americans. Prosecutors also summoned a second US employee on Monday and took his wife and child into custody, according to reports in the Turkish press.

Like many of the disputes between Washington and Ankara, the basic issue here is Turkey’s ongoing obsession with an elderly man who lives in Pennsylvania: Fethullah Gulen, a powerful Turkish Muslim cleric.

Gulen was once a key ally of Erdogan’s, but he fled to the United States nearly two decades ago. The Turkish government accuses Gulen of masterminding last year’s failed coup, which the cleric denies. Speaking to Al Jazeera, Erdogan adviser Burhan Kuzu claimed that the arrest of the first US Consulate employee had embarrassed Washington because the man had information about an alleged American role in the coup attempt. “The visa move came in order to pressure Turkey to give up this person,” Kuzu said.

Over the past year, there have been widespread conspiracy theories about American involvement in the attempted coup, despite frequent denials from the US government. A number of American citizens are among the 50,000 people who were arrested after the coup; US officials suspect that they are bargaining chips in Turkey’s bid for Gulen’s extradition.

Gulen is just one bone of contention out of many for Washington and Ankara. During the Obama administration, Erdogan had numerous disagreements with American foreign policy, most notably on Syria and the Kurds, while Obama also criticised Turkey’s creeping authoritarianism and human rights abuses. Washington’s muted response to the 2013 coup in Egypt, as well as its awkwardly neutral response to the attempted coup in Turkey, made Ankara even more paranoid about American intentions.

There had been hope that President Trump — a man perhaps more comfortable with autocracy and eager to push back on Obama’s legacy — would offer a fresh start for the two nations. There were a few positive signs from both camps: Trump was the only world leader to congratulate Erdogan after voters approved controversial constitutional changes in April, while the Turkish leader publicly called for a “reset” with Washington.

But almost nine months into his term, Trump has shown little positive interest in Turkey. His administration has agreed to arm the YPG, a group of Syrian Kurdish fighters that Turkey sees as allies of the PKK, the Kurdish separatist party in Turkey. Last month, US federal prosecutors indicted a former Turkish minister of the economy for allegedly conspiring with Reza Zarrab, a Turkish-Iranian gold trader, to skirt sanctions on Iran.

Then there was the viral footage of Erdogan’s bodyguards allegedly beating protesters outside the Turkish ambassador’s residence in Washington — a major blow to Turkey’s reputation among Americans. All of this means Gulen will probably remain a Pennsylvania resident for the foreseeable future.

In a country where the “deep state” is much feared, many Turks view the problem as not Trump himself but the bureaucracy that surrounds him. Writing in the pro-government Daily Sabah last week, Washington correspondent Ragip Soylu suggested that “the establishment in Washington” was targeting Turkey, just as they were targeting Trump, “because he is also an outsider.”

Such a narrative may suit Erdogan, at least in the short term. There’s long been an anti-American tendency in Turkish society, but it became far more potent after the 2016 coup attempt.

Reports have suggested that a “Eurasianist clique” that seeks closer relations with Russia is gaining sway within the powerful Turkish military.

The idea of shadowy American powers protecting the shadowy cleric Gulen also offers an easy excuse for any failings. As Soner Cagaptay, author of the recent book “The New Sultan: Erdogan and the Crisis of Modern Turkey” suggested to The Post in May, Erdogan may not even want Gulen to be extradited lest he become “more of a martyr rather than a nefarious coup plotter.”

But these short-term gains mask the long-term risks of the diplomatic spat. Thousands of American and Turkish tourists, academics and businesspeople have had their lives disrupted, while Turkey’s economy is already wobbling. Erdogan may want to flirt with abandoning the West, but following through on that rhetoric would probably hurt his own country more than others.