President Trump has often touted his personal chemistry with leaders like Xi Jinping of China or the royal family of Saudi Arabia as the key component of his foreign policy approach. He has described his handshake with Kim Jong-un in Singapore as more important than the terms of the agreement they signed. He has suggested that if Vladimir Putin were readmitted to the G-8, he could ask the Russian leader to “do me a favor” by withdrawing forces from Syria or Ukraine. But the latest news from Turkey suggests the limits of this approach.

After weeks of seeming improvement, U.S.-Turkish relations took a nosedive this week, with Trump threatening on Twitter to “impose large sanctions” on the country over the ongoing detention of American pastor the Rev. Andrew Brunson. Vice President Mike Pence made a similar threat the same day, and the Senate Foreign Relations committee this week unanimously passed legislation that would use U.S. influence on the World Bank to prevent financial assistance to Turkey as long as Brunson and other U.S. citizens are detained. Turkey’s foreign minister responded to the threats, “No one dictates Turkey. We will never tolerate threats from anybody.”

About a dozen Americans were among the thousands of people who were jailed in Turkey, often on the flimsiest pretext, as part of a sweeping security crackdown that followed an attempted coup against President Recep Tayyip Erdogan’s government in 2016. Brunson’s case in particular, which I wrote about last year, has become a major cause among evangelical Christians in the U.S. Pence has taken a particular interest in the pastor, and Brunson is represented in the U.S. by the American Center for Law and Justice, a conservative Christian legal advocacy group led by attorney Jay Sekulow, who is also part of Trump’s personal legal team.

The pastor, originally from North Carolina, had lived with his family in Izmir for 23 years until he was arrested in October 2016. He has been charged, with virtually no apparent evidence, with having ties to Fethullah Gulen—the U.S.-based exiled cleric whom the government accuses of orchestrating the coup—as well as the outlawed Kurdish militant group, the PKK. Brunson’s supporters charge that he is being used as a bargaining chip by the Turkish government in its disputes with the U.S.

There are certainly plenty of those disputes. Erdogan has explicitly linked Brunson’s fate to Turkey’s attempts to get the U.S. to extradite Gulen, who currently lives in Pennsylvania. “Give [Gulen] to us. Then we will try [Brunson] and give him to you,” Erdogan said last September. The Turkish government has also been angered by U.S. military support for the Syrian Kurdish YPG, an armed group with links to the banned PKK. Congress, meanwhile, has been working to block the Turkey from acquiring U.S.-made F-35 fighter jets.

Amid the squabbling, Erdogan’s government has also charged a Wall Street Journal reporter with supporting terrorism and arrested a U.S. Embassy employee for espionage, and Erdogan’s bodyguards were filmed beating protesters in Washington during a visit last fall.

There had recently been signs of improvement, however. In early June, the U.S. and Turkey agreed to a plan to remove U.S.-backed Kurdish forces from Manbij, a northern Syrian town that has become a major flashpoint in the conflict. The agreement handed a significant victory to Erdogan a few weeks before last month’s election, in which the president won a new five-year term with significantly expanded executive powers. The White House has also lobbied congress against holding up the F-35 sale.

According to a Washington Post report Friday, Trump also had reason to believe he’d reached a deal that would secure Brunson’s release. Under the agreement reached at the recent NATO summit in Brussels, Trump reportedly called Israeli Prime Minister Benjamin Netanyahu to ask him to release a Turkish woman detained on charges of smuggling for Hamas—an arrest Erdogan had publicly criticized—in exchange for Brunson’s release. Haaretz has also confirmed the phone call. But on July 18, a few days after Israel deported the woman back to Turkey, a Turkish court rejected Brunson’s appeal for release.* Trump called it a “total disgrace” on Twitter. This week, Brunson was moved to house arrest, a move that Secretary of State Mike Pompeo called “welcome,” but not enough.

Through all the tensions of recent months, Trump has, to a fault, continually praised and flattered Erdogan, describing him as a “friend of mine” and saying the U.S. and Turkey are “as close as we’ve ever been.” Trump has congratulated Erdogan on a controversial referendum that cemented his autocratic rule and praised his efforts at fighting terrorism—efforts that, according to Turkey, include attacks on America’s Kurdish allies and the imprisonment of a U.S.

pastor. According to one account of the NATO summit, Trump, during a diatribe against America’s European allies, turned to Erdogan and praised him for doing things “the right way” and then fist-bumped him. The move got heavy coverage from Turkey’s pro-government media.

Trump seems to have been under the impression that all of this flattery would make his good friend Erdogan more likely to do him a solid by releasing a U.S. citizen. Instead, it seems to have led Erdogan to conclude that he could jack up the price a little more.