Trump tweets support for American pastor Andrew Brunson jailed in Turkey

President Trump has blasted the detention of an American pastor in Turkey, and said that he is “more a Spy than he is.”

Andrew Brunson, a 50-year-old Protestant preacher originally from North Carolina, has spent more than 20 as a missionary in the Turkish city of Izmir, though now faces a trial that could keep him behind bars for three decades.

He has been detained for 18 months amid allegations that he supported groups behind an unsuccessful 2016 coup that tried to topple the regime of an increasingly hard line Recep Tayyip Erdogan.

“Pastor Andrew Brunson, a fine gentleman and Christian leader in the United States, is on trial and being persecuted in Turkey for no reason,” Trump posted on Twitter late Tuesday.

“They call him a Spy, but I am more a Spy than he is. Hopefully he will be allowed to come home to his beautiful family where he belongs!”

Brunson is one of thousands who were arrested after the failed coup, which Erdogan has blamed on an exiled elderly cleric who lives in a small town in the Poconos Mountains in Pennslyvania.

Turkey has labeled the cleric, Fetullah Gulen, as a terrorist and repeatedly asked the U.S. to extradite him, part of a decline in U.S.-Turkish relations that has included clashes between Erdogan’s bodyguards and protesters in Washington last year and Turkey a NATO ally, attacking U.S.-backed Kurdish forces in Syria.

Erdogan has said that Brunson could be freed in exchange for Gulen, who denies any role in the coup, though U.S. officials have denied that there should be any sort of transaction in exchange or the pastor's freedom.

RELATED: The case of jailed pastor Andrew Brunson

Brunson has denied any involvement with the coup or with Kurdish separatists, saying that he is not interested in politics but in prayer.

Trump’s Twitter diplomacy came after a Turkish court, which could have let the American go to house arrest at the beginning of his trial this week, decided to keep him incarcerated.

Former Kansas Sen. Sam Brownback, now a State Department ambassador for religious freedom, and North Carolina Sen. Thom Tillis were both in Turkey for the beginning of the trial.