More than two months after a rump military group and its backers tried to overthrow the elected government of Turkey — bombing the parliament, sending tanks into the streets and only narrowly failing in an attempt to kidnap the president — the Turkish government last week sent Washington its first evidence that an elderly cleric living in rural Pennsylvania was the mastermind of the coup attempt.

If the information persuades the Justice Department, a federal court will decide whether to accede to Turkey’s demand that Fethullah Gulen, a Turkish imam who has resided under self-

imposed exile in the United States for nearly two decades, be sent home to face charges.

Should the Justice Department or the court be unconvinced, or the process take too long, U.S. relations with the West’s most important Muslim-majority ally are likely to hit new lows.

Already, a surge of Turkish anger about reactions of its NATO allies in Europe and the United States to the failed insurrection has challenged the alliance’s trust and ties. Even as Turkish authorities express incredulity that President Obama has not taken action against Gulen, who has denied any involvement, they have faced widespread condemnation in the West for a vast purge of suspected coup plotters in the government and beyond.

[U.S. is trapped between its allies’ ambitions in Syria]

“Turkey has not seen the support it expected from its Western friends and allies,” Omer Celik, Turkey’s E.U. affairs minister, said in an interview. “They were not standing by us.” Last month, in what was widely seen as an attempt to broaden Turkey’s options, the country’s president, ­Recep Tayyip Erdogan, jetted to Moscow and patched up a lengthy estrangement with Russia.

But Turkish cooperation across a range of issues — from battling the Islamic State to holding back migrants from European shores — is seen as so important to the United States that the administration, despite its early criticism, now appears increasingly willing to tolerate a partner whose commitment to democratic rule of law has become shaky, at best.

In recent weeks, Washington has moved to mollify Ankara by acknowledging that it initially expressed insufficient outrage and concern about the coup attempt. In a trip to Ankara late last month, Vice President Biden toured the rubble-strewn parliament halls, apologized for taking so long to make a solidarity visit and made no mention of the arrests.

The Justice Department has sent a team of lawmakers to Turkey to help formulate the Gulen request, and the State Department has said it welcomes Turkey’s cooperation with Russia.

As a result, the worst tensions seemed to have eased. In addition to Biden’s visit, Erdogan and Obama met this month at a summit in China of the Group of 20 major world economies, and Gen. Joseph F. Dunford Jr., chairman of the Joint Chiefs of Staff, “recommitted to the close military-to-military and strategic relationship” between the two countries during a meeting with his Turkish counterpart Friday, the Pentagon said.

[Turkey’s Erdogan pivots to Putin as tensions rise with the West]

U.S. officials said they are confident that Turkey remains firmly anchored in the West. They described Erdogan’s outreach to Moscow, after a sustained period of alienation when Turkey shot down a Russian fighter jet that strayed over the Syrian border, as primarily to solidify economic rapprochement with a large and powerful neighbor and perhaps to tweak Washington a bit.

Turkish President Recep Tayyip Erdogan said that the United States should “not harbor a terrorist” like U.S.-based cleric Fethullah Gulen, who he blames for a foiled coup attempt, and that his activities should be banned around the world. (Reuters)

Many here think Turkey has few other realistic choices than the West for ensuring its own security. Underlining the limits of rapprochement with the Kremlin, the Russian Foreign Ministry recently expressed “grave concern” about Turkey’s recent intervention in Syria.

“Undoubtedly, the relations with the United States leave a lot to be desired, but if you look at things objectively, Turkey has nowhere else to turn,” said Soli Ozel, a professor of international relations at Kadir Has University, in Istanbul.

But tensions remain close to the surface. Turkish Prime Minister Binali Yildirim last week said that his government needed no “democracy lesson” from the United States, after the U.S. Embassy issued a relatively mild statement expressing concern at ongoing strife in the southeast. Police there had dispersed demonstrators protesting replacement of 28 town mayors across the heavily Kurdish region with government-appointed “trustees.”

Yildirim angrily called the statement “unacceptable” and said all of the mayors had been providing support to Kurdish terrorists. Interior Minister Suleyman Soylu said that “especially the envoys of countries we define as friends and allies do not have the right to make evaluations on this issue.”

Murat Esenli, deputy undersecretary responsible for European affairs at the Foreign Ministry, said, “We have no problem being criticized, but it has to be constructive criticism.”

Erdogan said he thinks Western powers seek his ouster, Turkish officials familiar with his views said. These officials, and those in the Obama administration, spoke on the condition of anonymity to provide candid assessments of the perspectives from both sides.

That impression was only strengthened by the Western response as the attempted coup unfolded, when Obama and other leaders appeared more concerned about the crackdown after the coup effort than the overthrow attempt itself, in which 241 people died.

Since then, authorities have jailed more than 40,000 people and stripped more than 100,000 of their jobs. Turkish leaders say the purges are needed to defeat a subversive conspiracy, while critics say that the roundups are also entrapping innocents without due process.

More broadly, Erdogan’s vulnerability to a coup suggested a weakness that surprised many Western allies.

“What this showed was perhaps the fragility of a number of Turkish institutions . . . that many of us here and many in the government in Turkey had not necessarily expected,” Simon Mordue, who leads the European Union’s negotiations over potential Turkish membership in the 28-nation bloc, said at a conference in Austria last month.

A number of programs are already under strain. After the coup attempt, Turkey cut an E.U.-funded scholarship program that pays for Turkish citizens to study in Europe. And the State Department suspended a range of exchange programs for the coming school year because of safety concerns.

On the defense front, Western officials worry that the purge of 40 percent of the Turkish military’s senior officers may have diminished the capabilities of NATO’s second-largest fighting force, although they insist that counterterrorism cooperation has not been affected. Several European politicians, meanwhile, have said they cannot imagine Turkish membership in the European Union within their lifetimes.

Beyond the immediate fallout from the coup attempt, the strain between the traditional allies is the culmination of growing mutual mistrust during Erdogan’s 14-year rule, officials on both sides said. Many Western leaders see him as an authoritarian leader who has sharply curtailed civil liberties. For years, Erdogan has oriented Turkey away from its modern secularist history, reaching back toward the Ottoman past for a more Islamist-inspired form of governance.

“This really changed the direction of Turkey, resulting in turning its back to the West. Not moving away from it, but turning toward the Muslim world,” said Osman Faruk Logoglu, a longtime leader of the opposition Republican People’s Party.

[Turkish evidence for Gulen extradition predates coup attempt]

Within Turkey, there are deep divisions between secularists and Erdogan supporters. But there is a near-universal belief, even among government critics, that Gulen, the cleric, was behind the coup attempt and that a wide-scale purge of followers of his movement is justified. His organization — a shadowy, conservative force that for years operated in alliance with Erdogan before a rupture in late 2013 — had established a foothold inside the military and civil service, analysts say.

Belief that the United States, at the very least, had to have known about the coup attempt in advance is similarly widespread and has led many Turks to echo the anger of their government. Turkey also has demanded that Gulen be detained in the United States while the extradition case is being considered, a request U.S. officials have said they cannot consider until the evidence is fully examined.

Many Turks described a wave of anti-Americanism they said will continue until the U.S. government begins procedures to extradite the Turkish-born Gulen.

“People are united against Gulen, not for Erdogan,” said Murat Yetkin, editor in chief of the Hurriyet Daily News.

There are some signs that the government may be growing more anxious about the widening rift. A delegation of elected officials representing Erdogan’s ruling Justice and Development Party visited Washington recently, meeting with members of Congress in an effort to explain Turkey’s position but also “to restore good relations,” said Ravza Kavakci Kan, a lawmaker representing Istanbul.

“The U.S. has been our good ally, and we have had our differences, but we don’t need any extra tension,” she said. “We want to be on good terms with everybody.”

And when Turkish officials here are pressed, they are more conciliatory than their fierce public rhetoric might suggest. When asked whether Turkey would kick the U.S. military out of its Incirlik Air Base in retaliation for U.S. support of Syria’s Kurds, Celik, Turkey’s E.U. affairs minister, said that “both Turkey and the U.S. sides know well to consider different files separately.”

Still, with such tensions, “the less tolerance each side has for the other saying, ‘We have options,’ ” said Eric Edelman, a former U.S. ambassador to Turkey. “The danger here is of a miscalculation.”

DeYoung reported from Washington. Kareem Fahim in Washington and Zeynep Karatas in Istanbul contributed to this report.

Read more:

Turkey expands its intervention in northern Syria

He’s 77, frail and lives in Pennsylvania. Turkey says he’s a coup mastermind.

Today’s coverage from Post correspondents around the world