President Trump’s abrupt increase in tariffs on Turkey, aggravating an economic crisis in the country that spilled into global financial markets on Friday, appeared to be a response to Turkey’s refusal to release an American pastor. But the escalation also reflected a litany of deep-seated grievances between the United States and Turkey that threatens relations between the two NATO allies.

Those grievances, analysts said, have been amplified by Mr. Trump and his Turkish counterpart, President Recep Tayyip Erdogan, both strong-willed leaders who share a penchant for invective and doubling down when threatened.

“You have all the ingredients for a catastrophe,” said Marc Pierini, a former European Union diplomat to Turkey who is now a visiting scholar at Carnegie Europe.

Sinan Ciddi, executive director of the Institute of Turkish Studies in Washington, said Mr. Erdogan and Mr. Trump were headed toward the “rabbit hole in Alice in Wonderland.”

How did it come to this? Here is a look at the issues behind the rising American tensions with Turkey, a country of 79 million that straddles Europe and Asia and has long played a vital role in the stability of the Middle East.

Who is the detained pastor and why did his case set off this flare-up?

Seemingly at the center of the dispute is the case of Andrew Brunson, a 50-year-old American pastor from North Carolina. Mr. Brunson has been detained in Turkey for more than a year and a half on suspicion of engaging in espionage and having links to plotters of the failed coup to topple Mr. Erdogan in 2016.

Mr. Brunson, who has done missionary work in Turkey for more than 20 years and headed a small church in the city of Izmir on Turkey’s Aegean coast, has denied the accusations. He could face 35 years in prison if found guilty.

Though Mr. Brunson was moved from prison to house arrest last month, his case has still touched a nerve in the Trump administration. Vice President Mike Pence and Secretary of State Mike Pompeo are devout evangelical Christians, a core voter group for Mr. Trump. The president has raised the case personally with Mr. Erdogan more than once, including in a phone call.

Turkey’s refusal to release the pastor, Mr. Pierini said, appeared to reflect “a complete misreading of U.S. policy by the Turks.”

The tensions aren’t just over Mr. Brunson’s arrest.

Bulent Aliriza, the director of the Turkey Project at the Center for Strategic and International Studies, a Washington research organization, said the Brunson case had “brought to a head simmering tensions in the U.S.-Turkish relationship.”

Those tensions date back years. Some historians tie the decline to 2003, when the Turks refused to allow American troops to transit through Turkey in the American-led invasion of Iraq.

Relations worsened during the last year of President Barack Obama’s administration, particularly over Turkish government accusations that the United States was involved in the failed coup.

Mr. Erdogan also has assailed the Americans for supporting Syria’s main Kurdish militia, which has links to a Kurdish separatist group that Turkey considers a terrorist organization. Mr. Trump took the unprecedented step in 2017 of arming that group, which was fighting the Islamic State in Syria, despite protests from Turkey.

To the Americans, Mr. Erdogan’s seeming tolerance of the Islamic State militants who had established themselves in Syria was unacceptable.

“The idea that Turkey is a bulwark against Islamic extremism is completely wrong,” said David L. Phillips, a Middle East expert who is a former adviser to the United Nations and State Department and is now a scholar at Columbia University. Turkey, he said, “hasn’t been behaving like an ally.”

American relations with Turkey were further aggravated by Mr. Erdogan’s embrace of Russia, particularly when Turkey signed a deal last September to purchase Russia’s S-400 surface-to-air-missile system. The deal would mean Russian military technicians operating in NATO’s backyard.

What especially irked the United States was that Turkey had also been in the midst of purchasing American F-35 joint strike fighters. Congress has since moved to block deliveries unless Turkey cancels the Russia deal.

The other elephant in the room: Turkey’s exiled cleric.

For Mr. Erdogan, one of the most grating grievances with the United States centers on the person he regards as the instigator of the failed coup: Fethullah Gulen, an influential Turkish cleric and former ally who lives in Pennsylvania. Mr. Gulen has denied the accusations.

Frustrated by what they saw as the Obama administration’s refusal to extradite Mr. Gulen, the Turkish authorities accused the United States of complicity with him. When Mr. Trump took office, there was some hope expressed by Mr. Erdogan’s aides that Mr. Gulen would be extradited. But there has been no indication of any change.

Didn’t Trump and Erdogan initially get along?

Yes, for a time it seemed that Mr. Trump had taken a liking to Mr. Erdogan, a strongman leader whom he praised after a NATO summit this year. But when negotiations between American and Turkish officials over Mr. Brunson’s release fell through, attitudes changed.

“There is that affinity Trump has with strong leaders, and Erdogan is certainly one of them,” Mr. Aliriza said. “But then something snapped, and it snapped on the Brunson issue because apparently Trump thought that he had a deal with Erdogan.”

Are Erdogan’s actions endangering the economy?

After Turkey’s June 25 election, Mr. Erdogan formally centralized the government under a presidency with vastly expanded controls and limited checks on his authority — a move that many critics say solidified his move toward one-man rule.

Mr. Erdogan’s autocratic behavior is now considered by outside economists and many investors as a threat to Turkey’s economy, once the envy of the region. Rapidly rising debts have fueled fears of insolvency in the country, now accelerated by a plunge in the value of the currency, the lira. Mr. Erdogan says he regards these stresses as the work of foreign conspirators.

“It was benefiting from tons of money coming in. It was on the way to becoming an E.U. member. It had good relations with the U.S.,” Mr. Aliriza said of Turkey. “Erdogan is now rejecting globalization, saying that the global economic forces that were his allies are now his enemies.”

With Mr. Erdogan’s son-in-law, Berat Albayrak, named as the new finance minister after the election, many economists argue that he has politicized the country’s economy by naming sycophants to positions of power.

Mr. Erdogan remained defiant in a speech on Friday in the northern city of Bayburt, saying his government “will not lose the economic war.”

But experts say he may be miscalculating the true effect of the sanctions imposed by the United States, and warn that there is nobody in Mr. Erdogan’s immediate circle who dares question his judgment.

“Essentially you’re heading for the cliff,” Mr. Pierini said. “The issue now is who will be courageous enough to tell the president, ‘This is the wrong way.’”

A version of this article appears in print on , on Page A8 of the New York edition with the headline: How Turkish Relations Reached Such a Low Point. Order Reprints | Today’s Paper | Subscribe