Andrew Brunson, an evangelical pastor from Black Mountain, N.C., arrives at his house in Turkey in July. (Emre Tazegul/AP)

Senior U.S. and Turkish officials will meet in Washington on Wednesday to try to resolve a dispute over Turkey’s ongoing detention of a U.S. pastor, an issue that has become the primary irritant in increasingly tense relations between the two.

Pastor Andrew Brunson is under house arrest near the city of Izmir after spending nearly two years in a Turkish prison under what the Trump administration has said are bogus allegations of aiding terrorists.

The outlines of a possible deal, possibly including an exchange of Brunson for a convicted Turkish national in the United States, are apparent to both sides, and both have expressed some optimism.

Secretary of State Mike Pompeo and Turkish Foreign Minister Mevlut Cavusoglu spoke at last week’s meeting of Asian states in Singapore and spoke by telephone Monday in what State Department spokeswoman Heather Nauert said was a “positive sign.” On Tuesday, as a Turkish team led by the No. 2 officials from the Foreign and Finance ministries headed to Washington, the U.S. Embassy in Ankara tweeted that “the United States continues to be a solid friend and ally of Turkey.”

The embassy added that Turkish news media reports that an “American official” had predicted a further precipitous fall in the Turkish lira — which dropped to a record low against the dollar Monday before stabilizing — were “completely unfounded” and “a fabricated and baseless lie.”

But despite the temperature-lowering moves, mutual suspicion and allegations of bad faith remain between the NATO allies over a variety of issues, including the Turkish purchase of F-35 jets, as well as Syria, said officials who spoke on the condition of anonymity about the sensitive Brunson case.

Resolution of the Brunson matter was complicated last week when President Trump ordered U.S. sanctions freezing any assets held in this country by two Turkish cabinet ministers, following the breakdown of what he apparently thought was an arrangement he made in person with Turkish President Recep Tayyip Erdogan during last month’s NATO summit.

Trump came away from their conversation, at least part of which took place during a stroll together accompanied only by interpreters, believing Erdogan was prepared to “help him out” in arranging Brunson’s release, according to a White House official. For his part, Erdogan asked for Trump’s help in intervening with Israel to facilitate the release of a Turkish national being held there on charges of aiding Hamas, officials said.

The Turkish woman was deported from Israel within days, but a subsequent court hearing in Brunson’s case resulted only in his release to house arrest.

Officials in both countries now say that the discussion between the leaders was vague. To Turkish officials, sending Brunson — who has lived nearly two decades in Turkey — to await trial at his home was a step in the right direction. To the White House, and U.S. lawmakers and Christian activists who have made his case a cause celebre, it accomplished little.

Erdogan, who is facing domestic difficulties, said Saturday that the imposition of sanctions was a harsh and unwarranted response. Trump had been “played, and I know very well who played him,” he said. Although he announced reciprocal sanctions against U.S. Cabinet members, commentators in Turkey’s pro-government media have placed the blame for the U.S. action largely on Vice President Pence, who has repeatedly elevated the Brunson case in speeches to evangelical Christian groups.

As both sides return to the drawing board, Turkish officials are seeking the release of Mehmet Hakan Atilla, a Turkish banker convicted in May of taking part in a massive scheme to violate U.S. sanctions against the purchase of Iranian oil. The high-profile federal trial also involved Halkbank, a Turkish state bank, and Turkish gold trader Reza Zarrab, who pleaded guilty and cooperated with authorities.

Atilla was sentenced to 32 months, of which, dating from the time of his arrest, he still has nearly a year to serve. Turkey, which has proclaimed his innocence, wants him back.

His release could be accomplished under a treaty that allows foreign nationals sentenced in the United States to serve at least part of their term in their own country. But that option is complicated by a treaty provision that prohibits the transfer if legal cases are pending. There are two pending cases — Atilla has appealed his conviction, and the government, which had requested that he be imprisoned for 20 years, has appealed his relatively light sentence. Both appeals would have to be dropped before any application for a transfer to Turkey could be considered.

“He wants to go home,” Atilla attorney Victor J. Rocco said in an interview. But “we have no idea, and he has no idea, about any deal. No one has approached him about any deal.”

Trump could also issue a pardon for Atilla or commute his sentence, both of which would lead to his immediate release.

But it remains unclear whether sending Atilla home would be enough for Turkey, which has also protested a pending fine against Halkbank in the case and has raised objections about the arrest of a number of other Turkish citizens charged here with Iran sanctions violations.

Other issues between the two countries — including U.S. legislation barring the export of F-35 jets that Turkey has already purchased as part of a co-production deal, and its request for U.S. extradition of a Turkish cleric living in Pennsylvania who it says masterminded a 2016 coup attempt against Erdogan — are unlikely to be put on the table as part of a Brunson agreement.

For its part, the United States has said it wants more than Brunson, including what a State Department official said is the release of a relatively small number of U.S.-Turkish dual nationals and several Turkish employees of the U.S. Embassy who are detained.

Virtually all were arrested, as was Brunson, for alleged involvement in the coup attempt.

Kareem Fahim in Istanbul and John Hudson, Josh Dawsey and Carol Morello in Washington contributed to this report.