The Trump administration has launched an intensive diplomatic effort to try to secure freedom for an American pastor who has been held in Turkey for nearly two years on what the U.S. says are dubious terrorism charges.

With full support from President Donald Trump, U.S. officials have been trying to persuade Turkey to quickly release Andrew Brunson, the North Carolina pastor caught up in a nationwide crackdown on dissent following a botched 2016 military coup attempt.

Some U.S. officials had expressed hope that Mr. Brunson would be freed on Wednesday when he appeared in a Turkish court for his latest hearing. But that prospect gave way to disappointment when the Turkish judge sent Mr. Brunson back to prison until October.

U.S. officials continue to press Turkey for a deal, with some expressing hope that an agreement still can be worked out soon.

Mr. Trump raised Mr. Brunson’s case on Monday in a call with Turkish President Recep Tayyip Erdogan, U.S. officials said. Secretary of State Mike Pompeo called his Turkish counterpart on Wednesday to discuss Mr. Brunson’s release, the officials said.