By steadily spooling out grisly details of the killing, Mr. Erdogan has found common cause with American lawmakers outraged by Saudi Arabia’s brazen tactics. Before that, some American politicians were more focused on castigating Turkey, a fellow NATO member, for backsliding on democracy and purchasing an antimissile defense system from the Russians.

“The main benefit has been with Erdogan earning political capital in Washington, which will be useful,” said Sinan Ulgen, a former diplomat for Turkey and the chairman of the Center for Economics and Foreign Policy Studies in Istanbul.

Even if he failed to cause a shift in policy within the Trump administration, Mr. Erdogan is unlikely to let the Khashoggi case go. Turkey has called for a United Nations inquiry into the killing and continues to demand answers, if only to clip the wings of the Saudi prince, whom Mr. Erdogan sees as a threat.

At the height of the affair, Turkish officials were calling on Washington to shift its alliances in the Middle East, hoping to nudge the United States away from the powerful monarchies of Saudi Arabia and the United Arab Emirates, as well as from the secular military leadership of Egypt.

Turkey has squared off with Saudi Arabia on a number of fronts, including the kingdom’s dispute with Qatar. Mr. Erdogan’s government also opposes American sanctions on Iran, putting it directly at odds with the Saudi crown prince, often known by his initials, MBS, who described Turkey as part of a “triangle of evil.”

“It was a far-fetched idea that Trump would drop MBS,” said Mr. Ulgen. “There will be some disappointment in Ankara, but also realism.”