A Turkish court has released American pastor Andrew Brunson whose detention had dramatically eroded relations between the Nato allies and sent the Turkish economy into free-fall.
Prosecutors had charged the evangelical protestant pastor with support for Kurdish militants and the US-based preacher Fethullah Gulen, accused by Turkey of masterminding a failed coup in 2016.
President Recep Tayyip Erdogan's crackdown led to the arrests of thousands of suspected supporters, including Mr Brunson. The move prompted US tariffs that choked the Turkish economy and sent the lira tumbling.
US President Donald Trump welcomed the ruling on Twitter. "Pastor Brunson just released. Will be home soon," a message on his account said in all caps. He had tweeted before the verdict: "Working very hard on Pastor Brunson!"
Mr Brunson, dressed in a black suit and white shirt, wept in relief as the court in Aliaga sentenced him to three and a haff years, meaning he would be released with time served.
PASTOR BRUNSON JUST RELEASED. WILL BE HOME SOON!— Donald J. Trump (@realDonaldTrump) October 12, 2018
"I am an innocent man. I love Jesus, I love Turkey," Mr. Brunson, who had lived in Turkey for more than 20 years, told the court before the sentencing.
In Friday's hearing it quickly became apparent that the case against him was unravelling as witnesses walked back previous testimonies.
My thoughts and prayers are with Pastor Brunson, and we hope to have him safely back home soon!— Donald J. Trump (@realDonaldTrump) October 12, 2018
The court nonetheless convicted him on the terror charges, but the sentencing seemed calculated to save face while releasing the pastor, whose detention had become a millstone around the neck for Turkey's economy.
The tensions with Washington had sent the Turkish lira down by 40 per cent. It rose by 3 per cent on Thursday in anticipation of Mr Brunson's release.
The US, Turkey's largest steel market, had imposed 50 per cent tariffs on Turkish steel in August after failed negotiations to free the pastor. It also imposed sanctions on Turkish government ministers.
Mr Brunson, who is 50 and from North Carolina, had headed a small congregation in Aliaga. He will travel back to the United States on his release.
Mr Brunson's detention had not been the only strain on ties with Washington, which have been tested by US support for Kurdish rebels in Syria and Turkey's plans to buy Russian missiles.
His release, which will be welcomed by Trump and Pence's evangelical base, may provide a boost for the Republicans in November's congressional elections.