US pastor Andrew Craig Brunson escorted by Turkish plain clothes police officers arrives at his house on July 25, 2018 in Izmir.

A Turkish court ruled on Friday to release the U.S. evangelical Christian pastor at the center of a bitter diplomatic row between Ankara and Washington, a move that could be the first step towards mending ties between the NATO allies.

The court passed a 3 years and 1 1/2 month sentence on Brunson, who had been charged with terrorism offenses, but said he would not serve any further time because he had already been detained since October 2016.

Witnesses said Brunson wept as the decision was announced. Before the judge's ruling, the pastor told the court: "I am an innocent man. I love Jesus, I love Turkey."

The case against Brunson, an evangelical preacher from North Carolina who has lived in Turkey for more than 20 years and was arrested two years ago, had led to U.S. tariffs against Turkey and drawn condemnation from President Donald Trump.

Trump tweet

Brunson was charged with links to Kurdish militants and supporters of Fethullah Gulen, the cleric blamed by Turkey for a failed coup attempt in 2016. Brunson denied the accusation and Washington had demanded his immediate release.

Earlier, witnesses told the court that testimonies attributed to them against the pastor were inaccurate, heightening expectations that Brunson could be released and returned to the United States.

Brunson appeared in the courtroom in the western coastal town of Aliaga wearing a black suit, white shirt and red tie. His wife Norine looked on from the visitors' seating area as he listened to testimony from defense and prosecution witnesses.

"I do not understand how this is related to me," Brunson said after the judge questioned one of a series of witnesses. He said the judge was asking the witness about incidents Brunson was not involved in.

The lira was little changed on the day. It had firmed 3 percent on Thursday on expectations that he would be released. It stood at 5.910 at 1336 GMT.