WASHINGTON — An American pastor may soon be released after two years of captivity in Turkey.

A person involved in efforts to free Andrew Brunson says the 50-year-old evangelical pastor from North Carolina could be freed at his next court appearance on Friday. The person spoke on condition of anonymity because officials had not yet reached a final agreement on the release and it could still fall through.

State Department spokeswoman Heather Nauert told reporters that the U.S. is hopeful he will soon go free but said she was unaware of any agreement on his release.

President Donald Trump has demanded his release, and his case has added further complications to an already strained relationship.

"I'm very hopeful that before too long Pastor Brunson ... and his wife will be able to return to the United States," Secretary of State Mike Pompeo said Wednesday. "It's the right thing for (Turkey) to do, it's the humanitarian thing for Turkey to do."

Brunson was among thousands of people arrested in Turkey in police sweeps following a failed July 2016 coup against President Recep Tayyip Erdogan. He is accused of working to convert Kurds to Christianity to destabilize Turkey.

Brunson is under house arrest but could get up to 35 years in prison if convicted on charges that his lawyers say are baseless.

Get the latest news, sports and weather delivered straight to your inbox. Click here to sign up for email and text alerts.