Turkey’s Foreign Ministry responded Thursday to President Donald Trump’s characterization on Twitter of the arrest of American Pastor Andrew Brunson as a “total disgrace,” insisting that his prolonged detention is a “legal process” necessary for the country’s national security.

Turkish police arrested Brunson, originally from North Carolina but with 23 years of experience serving Christians in Turkey, in mid-2016, shortly after the failed coup against President Recep Tayyip Erdoğan. He stands accused of being a member of Islamic cleric Fethullah Gülen’s “Hizmet” movement – known by Turkish authorities as the Fethullahist Terrorist Organization (FETO) – and of aiding the Marxist Kurdistan Workers’ Party (PKK), a U.S.-designated terrorist organization. Brunson denies the charges, noting that, as a Christian, neither an Islamic religious group nor a violent Marxist militia appeal to him.

Brunson’s family has accused the Turkish government – under Erdoğan’s Islamist Justice and Development Party (AKP) – of arresting Brunson for being a Christian. Erdoğan himself has hinted that he arrested Brunson to use him as a hostage to trade for Gülen, who lives in Pennsylvania.

The Turkish judiciary ruled against releasing Brunson yet again on Wednesday.

“The Brunson case is a legal process,” Turkish Foreign Ministry spokesperson Hami Aksoy said on Thursday. “And the process is ongoing. He is able to meet with his family, lawyers and consulate officials regularly. This judicial process is conducted on the principle of the rule of law.”

“Turkey is a state of law,” Aksoy insisted. “[The court’s] decision should be considered within this framework.”

According to the pro-Erdoğan newspaper Sabah, Aksoy also brought up Gülen, complaining that the United States must not “keep stalling” his extradition. Erdoğan blames Gülen for personally organizing the failed coup against him on July 15, 2016, a claim Gülen denies. The organizers of the coup released a message as it was transpiring, identifying themselves as constitutional secularists in the military, not members of Gülen’s Islamic group.

“Under normal circumstances, Gülen should have already been arrested since Turkish authorities issued an official request for his extradition under the 1979 treaty between the U.S. and Turkey,” Sabah complained. American authorities have refused to extradite him, however, noting that Turkey has not provided sufficient evidence that he is guilty of any crime.

Aksoy’s remarks Thursday followed a stern condemnation of the Turkish legal system from President Trump, who tweeted late Wednesday directly at Erdoğan, demanding Brunson’s release.

“A total disgrace that Turkey will not release a respected U.S. Pastor, Andrew Brunson, from prison,” Trump wrote. “He has been held hostage for far too long”:

A total disgrace that Turkey will not release a respected U.S. Pastor, Andrew Brunson, from prison. He has been held hostage far too long. @RT_Erdogan should do something to free this wonderful Christian husband & father. He has done nothing wrong, and his family needs him! — Donald J. Trump (@realDonaldTrump) July 19, 2018

Erdoğan’s account has not tweeted since July 15, the second anniversary of the failed coup.

Trump’s statement echoes the demands made by America’s charge d’affaires in Turkey, Philip Kosnett, who demanded Brunson’s release at his hearing Wednesday.

“I’ve read the indictment, I’ve attended three hearings. I don’t believe that there is any indication that Pastor Brunson is guilty of any sort of criminal or terrorist activity,” Kosnett told reporters. “We have great respect both for Turkey’s traditional law as a haven for people of all faiths and for Turkey’s legal traditions. And we believe that this case is out of step with those traditions.”

Turkish pro-Erdoğan media have continued to publish the accusations against Brunson. One particularly accusatory report calls Brunson a “Rambo priest” and undercover CIA agent who was promised the job of CIA director if the 2016 coup succeeded.

These claims stand in contrast to Erdoğan’s statements personally. Erdoğan has suggested that Brunson is not dangerous enough to keep behind bars, but that he would only release him in exchange for Gülen.

“We have given you all the documents necessary [for the extradition of Gülen]. But they say, ‘give us the pastor,'” Erdoğan said in September. “You have another pastor in your hands. Give us that pastor and we will do what we can in the judiciary to give you this one.”

President Trump has made the release of American citizens wrongfully imprisoned abroad a priority for his administration. Among those released so far are North Korean hostages Kim Dong Chul, Kim Hak Song, Tony Kim, and the late Otto Warmbier; Chinese hostage Sandy Phan-Gillis; Venezuelan hostage Joshua Holt and wife Thamara Caleño; and Taliban hostages Caitlan Coleman, Canadian husband Joshua Boyle, and their children.

Follow Frances Martel on Facebook and Twitter.