IT WAS all smiles and backslaps between Donald Trump and Recep Tayyip Erdogan, the presidents of America and Turkey, at a NATO summit in Brussels last month. And why not? The two men share a taste for demagoguery, handing government jobs to relatives and insulting (or, in Mr Erdogan’s case, imprisoning) journalists. But their relationship has suddenly soured.

The row centres on Andrew Brunson, a Presbyterian preacher from North Carolina who was imprisoned in Turkey in 2016 on flimsy terrorism and espionage charges. For two decades Mr Brunson ministered to a tiny flock of Turkish Protestants in Izmir. Christian missionaries are often regarded with suspicion in Muslim-majority Turkey. But Mr Brunson’s woes are of a more earthly sort. Relying on secret testimony, Turkish prosecutors allege that he supported an abortive military coup in 2016 that Mr Erdogan says was orchestrated by Fethullah Gulen, a cleric based in Pennsylvania. Mr Brunson also stands accused of links to Kurdish terrorists. His trial began in April. The charges, which he firmly denies, carry up to 35 years in prison. Mr Brunson’s family say he has lost weight and suffered depression, and was kept in overcrowded conditions. His cause has been taken up by evangelical Christians in America, led by Mike Pence, the vice-president.

Last week the dispute appeared close to resolution. Mr Trump believed that Turkey would free Mr Brunson in exchange for his efforts to persuade Israel to release a Turkish woman held on smuggling charges. The Americans reportedly also offered to go easy on Halkbank, a Turkish state lender that faces penalties for helping Iran evade sanctions. But the deal collapsed after a Turkish court merely remanded Mr Brunson to house arrest. Mr Trump fumed that America would impose “large sanctions” on Turkey for the prolonged detention. Denying that he had agreed to a swap, Mr Erdogan dismissed these threats as “psychological warfare”. But they are rather more than that. On August 1st the Treasury imposed financial sanctions on two Turkish ministers. Congress is considering a bill that would block loans to Turkey from international financial institutions. The Turkish lira has tumbled.

A series of other arguments has estranged the two countries. Turkey is outraged over American support for Kurdish rebels in Syria. Fearing that its NATO ally is slipping into Vladimir Putin’s orbit, America is refusing to deliver a shipment of F-35 fighter jets unless Turkey drops its plans to buy a Russian missile-defence system. Turkey has detained a dozen or so Americans, and three Turkish employees at American consulates, as part of a broader crackdown in connection with the foiled coup.

This tangle of disputes means Mr Trump’s threats may backfire. “Ankara sees Brunson as leverage in a grand bargain that includes resolution of all their differences,” said Sinan Ulgen, a former diplomat who runs EDAM, a think-tank in Istanbul. For Mr Erdogan to free Mr Brunson now, he adds, would be “perceived as buckling to American extortion”.

Other Americans incarcerated in Turkey are even worse off than Mr Brunson, since they lack advocates in the White House. In 2016 Serkan Golge, a 38-year-old Turkish-American physicist working for NASA, was arrested on suspicion of terrorism while on holiday in Turkey. In February he received a seven-and-a-half-year prison sentence. The evidence against him included such enormities as having an account at a Gulen-affiliated bank.