Andrew Craig Brunson, an evangelical pastor from Black Mountain, North Carolina, arrives at his house in Izmir, Turkey, Wednesday, July 25, 2018. Credit: Emre Tazegul | AP

A Turkish court on Wednesday ordered that Andrew Brunson, an American pastor detained for nearly two years on terrorism-related charges, be released from prison and placed under house arrest while his trial continues, Brunson’s Turkish lawyer said.

The Trump administration has repeatedly pressed the government of President Recep Tayyip Erdogan to release Brunson, 50, a longtime resident of Turkey who was swept up in a campaign of mass arrests that followed a coup attempt against Erdogan in the summer of 2016.

While the decision to place Brunson under house arrest could be a step by the Turkish government toward resolving his case — for instance, by deporting him — he remains on trial. He faces charges that include espionage and collusion with terrorist groups and is banned from travel, according to the court order. Local media outlets Wednesday circulated photographs of Brunson being released from prison in the western Turkish city of Aliaga.

In a message posted on Twitter, Secretary of State Mike Pompeo said the court’s decision was “welcome” but added that “it is not enough. We have seen no credible evidence against Mr. Brunson, and call on Turkish authorities to resolve his case immediately in a transparent and fair manner.”

Brunson’s case has been a major irritant as the relationship between the United States and Turkey has grown more acrimonious in recent years. The NATO allies have argued over the jailing of American citizens in Turkey, the war in Syria and Turkish plans to purchase a Russian missile defense system.

The intertwining of the disputes has put the administration between a rock and a hard place as it tries to mollify Turkish concerns while achieving U.S. objectives.

U.S. officials, and NATO, have said that a planned Turkish purchase of Russia’s S-400 air defense system would pose a serious security risk to alliance networks. At the same time, legislation signed into law by President Donald Trump last summer mandated sanctions against countries that do business with certain Russian industries, including defense.

The law could affect a number of U.S. allies who are also in negotiations with Russia over the S-400, including India. Saudi Arabia and Qatar have also expressed interest in the system.

More immediately, Turkey is specifically targeted in new provisions inserted in the fiscal year 2019 National Defense Authorization Act that delay, and open the door to potential cancellation of, Turkey’s purchase of 100 U.S.-made F-35 fighter jets, pending favorable resolution of the Brunson and air defense disputes. The conference version of the bill, completed this week, must undergo a final vote by Congress and be signed by Trump.

In remarks to Turkish media Wednesday in Ankara, Erdogan indicated that Trump had told him, when the two met at the NATO summit in Brussels this month, that the F-35 deal would go forward. “This issue, as you know, is completely at the disposal of the U.S. president,” Erdogan said, noting that Turkey has already paid $900 million on the aircraft contract.

Banning delivery of the jets, Erdogan said, “is out of the question.”

As it negotiated first with China and more recently with Russia over a new air defense system, Turkey has said that it would be happy to have the newest version of the U.S.-made Patriot system. But it has charged that the United States was blocking the purchase, apparently over U.S. resistance to Turkey’s pursuit of more technology transfers.

Turkish Foreign Minister Mevlut Cavusoglu, speaking at a panel during the NATO summit, said that deployment of the Russian system posed no threat to the alliance. “I tried to buy from my allies,” he said. “I wanted to buy from the U.S. for the last 10 years. It didn’t work. I couldn’t buy from NATO allies, so Russia gave me the best proposal.”

U.S. officials have recently indicated some flexibility.

The administration is “trying to give the Turks an understanding of what we can do with respect to Patriot,” Tina Kaidanow, the acting assistant secretary of state for political-military affairs, told reporters last week.

Additional outstanding issues between the two governments include U.S. administration plans to reimpose sanctions on the purchase of oil from Iran, including by Turkey, which buys more than half of its crude oil supplies from Tehran.

Congress has been far more adamant than the administration about not allowing the F-35 sale if other matters cannot be resolved. In a recent letter to lawmakers, Defense Secretary Jim Mattis warned that delayed delivery of the aircraft would not only harm relations with Turkey but would also start a “supply chain disruption” that could increase the price of the plane for other purchasers.

“If the Turkish supply chain was disrupted today,” Mattis wrote, “it would result in an aircraft production break, delaying delivery of 50-75 F-35s, and would take approximately 18-24 months to resource parts and recover.”

Beyond the planned Russian purchase, Sen. Jeanne Shaheen, D-N.H., a sponsor of the provision, said in a statement Tuesday, “the current state of relations and continued detention of innocent U.S. citizens and embassy staff does not allow for our two nations to discuss defense matters freely and openly.”

Several Turkish American citizens, and two Turkish employees of the U.S. Embassy there, have also been arrested on charges similar to those placed against Brunson.

In addition to insisting on Brunson’s guilt, Erdogan has also tied his case to his demand that the United States extradite Fethullah Gulen, a Turkish cleric living in Pennsylvania who is accused by Turkish authorities of orchestrating the failed coup. In a speech last year, he suggested that Gulen could be traded for Brunson.

Gulen has denied involvement in the attempted coup. The Justice Department, which must evaluate Turkey’s extradition evidence for presentation to a U.S. federal court, has not taken any action.

Follow the Bangor Daily News on Facebook for the latest Maine news.