Throughout Brunson’s ordeal, Erdoğan maintained that his case was not politically motivated and would be resolved in the courts, which he could not legally influence. Yet following several failed attempts to secure the pastor’s release over the summer, lawmakers in Washington grew impatient, imposing financial sanctions on the Turkish justice minister and interior minister in August. The move sent the already ailing Turkish markets into a downward spiral.

A few days later, Trump took to Twitter to announce that the United States would double tariffs on steel and aluminum imports from Turkey. Its currency, the lira, instantly plummeted against the U.S. dollar, losing roughly 40 percent of its value since the beginning of the year. All this destabilized Turkey’s economy, which relies heavily on foreign-denominated debt, and Turkish markets have been hit by inflation rates not seen since the early 2000s, muddying Erdoğan’s image as an economic reformer.

Turkish officials said Brunson’s release was not the result of such economic pressure. While he had received a jail sentence of more than three years, his punishment was reduced due to his good behavior, with consideration given to time already served. “The Republic of Turkey does not receive instruction from any body, authority, office or person. We make our own rules and make our own decisions that reflect our will,” Fahrettin Altun, a spokesperson for the presidency, said in a statement released on Friday.

Some Turkey analysts viewed Brunson’s release as a victory for Trump and his more confrontational approach to diplomacy. “Turkish authorities were told that [Trump] had other sanctions on his desk, ready to sign in case Brunson was not released after this hearing,” Ozgur Unluhisarcikli, the director of the German Marshall Fund in Ankara, told me. He also noted that Brunson’s release comes just ahead of the November midterm elections. “The president, through his actions … made the [Brunson case] his own legislative fight and he won it. This will mobilize his evangelical base in the upcoming midterm elections.” On Friday, Trump said Brunson would likely visit the White House after he lands in Washington on Saturday.

While the end of Brunson’s detention may smooth some of the tensions in the U.S.-Turkey relationship, numerous problems remain. (There has been much speculation, for instance, over how Brunson’s release was attained and whether American and Turkish officials made a deal behind closed doors. “I’m sure there is a tit for tat, but I don’t know what it is,” Unluhisarcikli said.)

High on the list of unresolved Turkish concerns is the fate of Mehmet Hakan Atilla, a Turkish banker who received a 32-month prison sentence in a Manhattan court in May for violating U.S. sanctions on Iran. Erdoğan has sought to bring him back to Turkey while also trying to prevent additional U.S. sanctions on the national bank Atilla oversaw. Few details of these negotiations have been made public, but the lack of U.S. cooperation thus far has not sat well with Ankara.