A court in Turkey has released a pastor from North Carolina who'd been held under house arrest. The case of Pastor Andrew Brunson has been a priority of the Trump administration and the subject of repeated talks and attempted high-level deals between the U.S. and Turkey. Brunson has lived in Turkey for two decades. And in 2016, he was arrested along with tens of thousands of other people after a coup attempt. He spent most of that time in jail before being allowed house arrest in July. NPR's Peter Kenyon is in Istanbul. Hi, Peter.

PETER KENYON, BYLINE: Hi, Noel.

KING: All right, so a long case this one. What do we know about Pastor Brunson and the charges against him?

KENYON: Well, he's lived for a long time in Izmir in Western Turkey. He's about 50 years old. He ran a small evangelical church there. But then, as you noted, in September 2016, he was arrested, charged with aiding terrorist groups, both Kurdish militants and this cleric that Turkey blames for that 2016 failed coup attempt. There are some who've been arguing that Brunson was basically caught up in this massive purge of Erdogan's suspected enemies - President Recep Tayyip Erdogan of Turkey. And in fact, he was held at first in jail. And then in this year, he was transferred to house arrest in late July. He's always denied the charges. There has been speculation that Turkey was hoping to trade Brunson for some Turks being held in U.S. jails. And Washington's been pushing for his release basically ever since he was detained.

KING: What did the court say about why he was being released today?

KENYON: Well, the court actually issued a conviction with a sentence of just over three years. The prosecutor had asked for 10. But at the same time, the judges ruled that Brunson shouldn't serve any more prison time than he already has, in part taking his health into consideration. The court also lifted judicial controls on Brunson. That means restrictions on his movements have been lifted. And he is now free to leave the country. You know, there were thoughts this might've happened earlier this year. The White House thought they had a deal after President Trump spoke with Turkey's president. But at that point, he was only moved from prison to house arrest, and that upset the White House. Pressure's been ratcheting up ever since. There's been sanctions back and forth. And there's no doubt that with the shaky economy here, Turkey really wanted to put this dispute behind them.

KING: I mean, the interesting thing here is how involved President Trump and Vice President Pence and Secretary of State Mike Pompeo have all been in this case. Why was it such a big priority for them?

KENYON: Well, the administration's well-known for close ties to the evangelical Christian community in the U.S. Certainly Vice President Pence, Secretary of State Mike Pompeo - well-known devout Christians. This is sure to please that part of Trump's constituency. Also on the plus side for the U.S., they're not actually trading anyone for Brunson. It was a matter of putting on sanctions and now lifting them. But I have to say this decision is also a big relief for Turkey and President Recep Tayyip Erdogan. He's struggling to hold the economy together. The currency is way down. The inflation is soaring. The sanctions from America on aluminum and steel and on cabinet ministers have added to the economic pain. And now Turkey has every expectation that those punitive measures will now be eased or lifted once Pastor Brunson is back on U.S. soil. So they're going to be quite happy with that aspect of it.