A Turkish court on Wednesday ordered an American pastor accused of espionage to remain incarcerated, ignoring pleas for his release from his lawyer and the United States government.

In a sign that tensions between Turkey and the United States have not eased, the court ordered the pastor, Andrew Brunson, to stay in jail until his next hearing, in October. By then, he will have been detained for two years.

Mr. Brunson, who has done missionary work in Turkey for the past 23 years, is on trial on charges of terrorism and espionage — one of 20 American citizens who have been prosecuted under a government crackdown since a failed coup in 2016.

The White House and members of Congress have raised Mr. Brunson’s case personally with Turkey’s president, Recep Tayyip Erdogan, including most recently in a phone call by President Trump. American officials had hoped the pastor’s release would signal an improvement in the fraught relations between the countries.

Secretary of State Mike Pompeo spoke with Foreign Minister Mevlut Cavusoglu of Turkey in a phone call immediately after the proceedings ended Wednesday in a court in Sakran, near the western city of Izmir.

“We are disappointed in the results of today’s hearing,” Philip Kosnett, chargé d’affaires and head of mission at the United States Embassy in Turkey, said outside court after the hearing. “I have read the indictment, attended three hearings. I don’t believe that there is any indication that Pastor Brunson is guilty of any sort of criminal or terrorist activity.”

And late Wednesday night in a post on his Twitter account, Mr. Trump said that Turkey’s refusal to release Mr. Brunson was “a total disgrace” and that Mr. Erdogan “should do something to free” him.