ISTANBUL — A Turkish court on Thursday ordered the continued detention of Metin Topuz, an employee of the U.S. Consulate in Istanbul whose imprisonment for nearly 18 months has infuriated the Trump administration and highlighted the rapidly deteriorating relationship between Ankara and Washington.

Topuz, a Turkish citizen who started working at the consulate more than three decades ago as a switchboard operator, has been charged with espionage and aiding a failed coup against the government of President Recep Tayyip Erdogan. U.S. officials have criticized the conditions of his detention — he is being held in solitary confinement — and dismissed the accusations against Topuz as baseless.

The officials also have accused the Turkish government of using Topuz and other imprisoned employees of U.S. consulates in Turkey as bargaining chips in negotiations on other thorny issues dividing the two countries.  

 His trial started Tuesday and was attended by officials from the U.S. Consulate as well as his family. On Thursday, a panel of judges denied a request by Topuz’s lawyers to release him from prison and place him under house arrest. As his relatives left the courthouse, Jennifer Davis, the U.S. consul general in Istanbul spoke with reporters.

“We did not see today in this hearing any evidence of criminal wrongdoing on the part of Metin Topuz, and we reiterate our government’s call for the swift and fair resolution of this case,” she said.  

 Relations between the United States and Turkey have come under growing strain since a failed coup against Erdogan’s government in 2016. The Turkish government has demanded that the United States extradite Fethullah Gulen, a Muslim cleric living in Pennsylvania who Turkish authorities have accused of orchestrating the coup attempt. The two NATO allies have sparred over the war in Syria, Turkey’s detention of an American pastor and, more recently, the decision by Erdogan’s government to purchase Russia’s S-400 air defense system.  

 Amid the tensions, U.S. officials in Turkey have been most disturbed by the arrests of consulate employees. The arrests have unnerved local staff working at U.S. missions and exposed the inability of American diplomats to protect them from the whims of Turkish prosecutors.   

 After Topuz was arrested in October 2017 — and accused in a pro-government newspaper of facilitating the escape from Turkey of Gulen’s followers — the United States tried to send a warning, announcing it was suspending the issuance of nonimmigrant visas in Turkey.  

 Ankara responded with identical restrictions. Topuz remained in prison. 

 Turkey has leveled weighty charges against Topuz, who has worked since 1992 for the Drug Enforcement Administration as a translator and liaison between American and Turkish officials. An indictment accuses him of “supplying state information” for the purposes of espionage and “attempting to eradicate the Republic of Turkey,” among other charges. The accusations appear mostly related to Topuz’s work at the DEA, where he was in contact with Turkish security officials who were later prosecuted for being members of the Gulen movement.

One key prosecution witness, Nizamettin Celikbilek, an informant for Turkish law enforcement, made multiple claims defense lawyers picked apart in court. Among them was the assertion that when he visited Topuz in the U.S. Consulate, he was made to give “samples of my skin” — a reference to an apparently nonexistent security procedure, according to the lawyers.

The witness also referred to a female colleague of Topuz named “Cameron.” That person was, in fact, a man, Topuz and his lawyers told the judges. Prosecutors also suggested that Topuz’s high-level reception by Turkish officials — and his casual demeanor among American colleagues — showed he was far more senior than his official responsibilities suggested.

 As the hearing Thursday came to a close, Topuz, wearing a wrinkled oatmeal-colored blazer, spent several minutes trying to refute the sometimes bizarre claims of the state’s witnesses. “I have done my job. These meetings I had were in the framework of my job, and of the law,” he said.

“I am innocent,” he added. “I have not committed any crime.”