In July, the two countries came close to agreeing to a coordinated release of Mr. Brunson and Mr. Atilla, but Mr. Erdogan held out for a guarantee that there would be no further prosecutions against Turkey for sanctions violations.

A Turkish court ordered that Mr. Brunson remain detained, though he was later moved to house arrest. Since August, he had been living with his wife, Norine, at their apartment in an old quarter of the seaside city of Izmir. Turkish courts several times refused his appeal for release on health grounds.

Faced with Turkey’s continuing refusal to free the pastor, Washington imposed financial sanctions on the Turkish interior minister and justice minister. Days later, Mr. Trump announced that the United States was doubling its tariffs on steel and aluminum imports from Turkey, just as the Turkish currency, the lira, began a precipitous fall against the dollar.

Mr. Erdogan vowed that he would not succumb to threats, and announced retaliatory measures, including increased tariffs on imported American cars, alcohol and leaf tobacco.

The lira, which has lost nearly 40 percent of its value since the beginning of the year, plunged to a record low, shaking international markets and raising concerns about Ankara’s ability to service its ballooning foreign debt. International credit rating agencies have repeatedly downgraded Turkey’s standing this year.

The Trump administration seemed unmoved by Turkey’s perilous economic situation, and continued to demand Mr. Brunson’s release before it addressed Turkey’s other concerns. In a Twitter post in August, Mr. Trump referred to Mr. Brunson as a “great patriot hostage.”

“We will pay nothing for the release of an innocent man, but we are cutting back on Turkey!” Mr. Trump declared.