By Ben Hubbard and David E. Sanger, New York Times–

BEIRUT, Lebanon — Russia, Iran and Turkey met in Moscow on Tuesday to work toward a political accord to end Syria’s nearly six-year war, leaving the United States on the sidelines as the countries sought to drive the conflict in ways that serve their interests.

Secretary of State John Kerry was not invited. Nor was the United Nations consulted.

With pro-Syrian forces having made critical gains on the ground, the new alignment and the absence of any Western powers at the table all but guarantee that President Bashar al-Assad will continue to rule Syria under any resulting agreement, despite President Obama’s declaration more than five years ago that Mr. Assad had lost legitimacy and had to be removed.

Mr. Obama’s reluctance to back that demand with more involvement as the war escalated leaves Washington with little leverage on a geopolitical crisis as President-elect Donald J. Trump prepares to take office.

Mr. Trump’s only recent statement on Syria came last week, when he declared at a Pennsylvania rally that the situation was “so sad” and promised, “We’re going to help people.” He vowed to extract funds from Persian Gulf nations to build “safe zones” in Syria “so people will have a chance,” without addressing the question of who would enforce those zones on the ground or in the air.

But by the time Mr. Trump is sworn in next month, such safe zones may be irrelevant, if the evacuation of Aleppo and political negotiations proceed.

More than a year after launching the air campaign that remade the battlefield in Mr. Assad’s favor, Russia appears to be looking for a way out of the war. Analysts say that Moscow sees in the transition an opportunity to end the conflict on favorable terms both for Mr. Assad and for Russia’s broader interests in the region.

“Russia understands that nobody gives you anything, you just have to take it, and in this environment, with the U.S. retreating faster than the other side can advance, it’s just a free for all,” said Andrew J. Tabler, a fellow at the Washington Institute for Near East Policy who studies Syria. “When the Turks, the Iranians and the Russians all agree on a process without the U.S. being in the room, you realize there is a problem for us.”

Russian officials have made little effort to hide their disdain for American diplomatic efforts.

Last week, Foreign Minister Sergey V. Lavrov said working directly with Turkey on the evacuation deal was more efficient than “fruitless get-togethers with the U.S.” On Tuesday, Mr. Lavrov said the International Syria Support Group, which he and Mr. Kerry led since 2015, had turned out “important documents,” but “has been unable to play its due important role in seeing to it that adopted decisions are implemented.”

The State Department spokesman, John Kirby, said on Tuesday that Mr. Kerry had spoken with Mr. Lavrov and Turkey’s foreign minister by phone, and he expressed skepticism that the new effort would be successful.

If the talks “lead to a sense of calm enough in Syria that political talks can resume, then that would be great and that’s what we’d like to see,” Mr. Kirby said, but added that “we have seen repeated promises to appropriately influence the Assad regime in the right way on the cessations of hostilities and seen those fail,” and said he held out little hope this would be different.

As Syrian forces and their allies retook rebel-held areas of Aleppo this month, Russia proposed new peace talks in Kazakhstan to replace those sponsored by the United Nations in Geneva. Russia also worked directly with Turkey — which changed its approach to Syria after years of backing the insurgents seeking to oust Mr. Assad — on the evacuation deal.

Since the Syria conflict started in 2011 with a popular uprising that evolved into a civil war, Mr. Obama has resisted direct American military involvement, arguing that it would not improve the situation and that Syria was not a core American interest.

Mr. Obama’s reluctance to challenge Mr. Assad angered the Syrian opposition and allies like Saudi Arabia who wanted Mr. Assad gone.

But the United States intervened in indirect ways, running covert programs with its allies to give the rebels arms, money and antitank missiles.

With the rise of the jihadists of the Islamic State, who seized territory in Syria and Iraq, the United States changed priorities. Washington led a coalition to bomb the group, also called ISIS or ISIL, and worked closely with Kurdish forces fighting the jihadists on the ground.

But that policy angered Turkey, which saw the United States arming fighters linked to the Kurdistan Workers’ Party, or P.K.K., which both Turkey and the United States consider a terrorist organization.

Over time, Turkey’s fight against Kurdish militants took precedence over its desire to see Mr. Assad replaced.

Another factor has shaped how the various foreign powers are approaching Syria.

“Trump,” said Aaron Stein, a senior fellow at the Atlantic Council who studies Turkey. “One of his early signals was that he was going to scale back support for the opposition that the U.S. has supported.”

Mr. Trump has not articulated a comprehensive Syria policy, but he has suggested he will work alongside Russia to fight extremists including the Islamic State.

The signs of a Russian-Turkish rapprochement were clear on Tuesday, despite the assassination of Moscow’s ambassador to Ankara by a man identified as a Turkish police officer.

In Moscow, Mr. Lavrov and his Turkish counterpart, Mevlut Cavusoglu, placed flowers next to a portrait of the ambassador, Andrey G. Karlov.

“Turkish people are mourning this loss as much as Russia and the people of Russia,” Mr. Cavusoglu said.

Mr. Lavrov said Russia was “grateful to our Turkish colleagues” for their condolences and their rapid response to the killing, adding, “This tragedy is making all of us combat terrorism in a more resolute way and is making our meeting today ever more relevant.”

At the meeting, Russia, Iran and Turkey agreed to “the Moscow Declaration,” a framework for ending the Syrian conflict. They did not consult the United States, nor did they invite Staffan de Mistura, the United Nations envoy for Syria, who has spoken of new peace talks in Geneva on Feb. 8.

“This is Turkey bending to Russia,” Mr. Stein said. “This is putting a fine point on Turkey’s policy of ‘Assad must go’ no longer being the policy.”

Iran’s presence is significant, as well. The original evacuation deal was between Russia and Turkey and involved only Aleppo. But Shiite militias loyal to Iran and fighting on the side of Mr. Assad prevented the first buses from leaving, demanding that the deal be renegotiated to include people from two Shiite villages in Idlib Province.

Iranian officials have boasted about their fighters’ role in Aleppo and that of the Lebanese Shiite militia Hezbollah, which helped besiege eastern Aleppo before the evacuation deal.

“As Russia has allied with Iran in the region, it is the coalition of Iran, Russia and Hezbollah that has caused Aleppo’s liberation, and very soon Mosul will also be liberated,” Yahya Rahim Safavi, a military aide to Ayatollah Ali Khamenei, Iran’s supreme leader, said last week. “It shows that this coalition has an upper hand and the U.S.’s president-elect has to face its weight.”

But the United States remains relevant in its relationships with rebel factions and the fight against the Islamic State, said Noah Bonsey, a Syria analyst with the International Crisis Group. Mr. Bonsey added that Mr. Assad’s coalition probably still lacked the personnel needed to take back the rest of Syria’s territory, but that as long as the United States wavered on involvement, other powers would fill the vacuum.

“Insofar as diplomacy on Syria can accomplish anything,” he said, “it will be between Russian and Turkey, with input from Iran.”