A Turkish court on Friday ordered the release of an American pastor held for the last two years in Turkey, in a case that sparked a crisis in ties with the United States. The court in the western town of Aliaga convicted Andrew Brunson on terror-related charges and sentenced him to three years, one month and 15 days in jail. However, he was freed taking into account time served and his good conduct in the trial, with the court lifting his house arrest and overseas travel ban. Brunson’s detention since 2016 caused not just one of the worst diplomatic rows of recent times between NATO allies Turkey and the US, but also a crash in the Turkish lira which exposed the country’s economic fragility. Turkish judicial authorities have repeatedly denied requests for the release of Brunson, who was moved from prison to house arrest in the city of Izmir in July. “I am an innocent man. I love Jesus. I love Turkey,” he said in his final defence. When the verdict was read out, Brunson wept and hugged his wife Norine. He had faced up to 35 years in jail on charges of aiding terror groups and espionage. Prosecutors then demanded a sentence of up to 10 years. It was not immediately clear where Brunson would go next, although some reports suggested he could fly to the United States imminently. The resumption of the trial came at a sensitive time for the Turkish leadership, which is under global scrutiny over how it handles the case of Saudi journalist Jamal Khashoggi, who disappeared at Riyadh’s consulate in Istanbul. Both Turkish President Recep Tayyip Erdogan and US President Donald Trump have pressed Saudi Arabia to explain what happened to Khashoggi.