Aliaga, Turkey (CNN) US officials believe they're on the verge of securing the release of Andrew Brunson , the American pastor jailed by Turkey on accusations he helped plot a coup against President Recep Tayyip Erdogan, according to a source familiar with the matter.

The source cautioned that US officials are counting on Turkish officials to follow through on their end of the agreement.

Brunson appeared Friday in court in Aliaga, on the Aegean Sea, facing three judges who could release him or jail him for up to 35 years.

Brunson arrived at the court before dawn Friday, while his wife, Norine Brunson, arrived later in a US diplomatic vehicle.

Bill Devlin, a supporter of the detained pastor and the co-pastor of the Infinity Bible Church in New York, told CNN before entering the courthouse: "We're hoping by the end of business today that he's going to walk a free man."

"All of us believe that he is an innocent man... he would not allow anything political to interrupt his gospel ministry here," he added.

Brunson, in a black suit and red tie, was calm and measured in his responses, as he stood in front of the judges alone, repeatedly looking over at his wife a short distance away.

A car carrying American pastor Andrew Brunson (second left) arrives at the Aliaga Prison Court ahead of his court hearing Friday.

Turkey has good financial and strategic reasons to release the American, analysts say, including the threat of further US sanctions related to Brunson, and its purchases of Russian weaponry and Iranian oil. But the source cautioned that Brunson has appeared close to release before.

Secretary of State Mike Pompeo said in late September that Brunson "could be released this month" and indicated again on Wednesday that he could be released soon.

"I'm very hopeful that before too long, Pastor Brunson will -- he and his wife will be able to return to the United States," Pompeo said at an awards dinner for the Jewish Institute for National Security of America. "President Trump has had a focus on it, the administration's had a focus on it and we're very hopeful that we'll see a good outcome before too long."

Turkish security personnel standing outside the courthouse in Aliaga, Turkey, where a court is expected to rule on the detention of American pastor Andrew Brunson.

However, Vice President Mike Pence, speaking on Thursday, dialed back expectations that Brunson's release is imminent. "I'm not able to confirm anything for you other than to say that (the) President's made clear, our administration's made very clear, that we will continue to stand strong until Pastor Andrew Brunson is free and back home in the United States with his family and with his church," he said.

A little later on Thursday, State Department spokesperson Heather Nauert told reporters, "I am not aware of any such deal. ... We're not aware of anything. There's a hearing that takes place tomorrow. There's a legal process to play out."

Brunson, whose possible release was first reported by NBC, has been held since 2016 and his imprisonment led to a rapid decline in relations between Turkey and the US after President Donald Trump took up his case, and the administration elevated religious freedom as a cause.

In August, Trump told reporters that Turkey had "not acted as a friend" and "they made up phony charges that he's a spy. He's not a spy."

Trump slapped Turkey, a NATO ally, with sanctions in August, targeting the country's justice and interior ministers. Treasury Secretary Stephen Mnuchin said at the time that the US was prepared to add more sanctions if Brunson wasn't released.

But there have been signs of a warming. Trump and Erdogan met briefly on the sidelines of the United Nations General Assembly in September for the first time since relations soured over Brunson. And shortly afterward, Erdogan predicted the two countries would weather the storm.

"Our strategic partnership, which has gone through difficulties so many times, will overcome this turbulent period," Erdogan said during an address at an investment conference held by the Turkey-US Business Council, according to Turkey's state-run Anadolu news agency.

Erdogan had said he wouldn't hand Brunson back to the US, but analysts at the Eurasia Group note that the Turkish President has recently shifted position, saying the decision wasn't his to make but would be made by the independent Turkish judiciary.

If the court lifts Brunson's house arrest order on Friday and doesn't impose a new travel ban, he will be free to leave the country.

"We see this as a possible face-saving way for Erdogan to agree to Brunson's release," the Eurasia Group said last week.

Erdogan has good reasons to make Brunson's release happen. If the pastor remains under Turkish arrest, ties between Ankara and Washington will worsen and Erdogan faces the prospect of more sanctions, not just for Brunson but for Turkey's recent purchase of Russian S400 defense missiles.

The Eurasia Group notes another danger. Turkey runs "a risk of the US Treasury announcing a substantial fine on Halkbank for violating US sanctions on Iran," its analysts said of the Turkish state-owned bank, adding that, "if Brunson is not released, the odds of Turkey receiving an Iran sanctions waiver from the US in early November for continued oil imports also go down significantly."