The Syrian government and its most important ally, Russia, announced on Thursday that they had reached a cease-fire agreement with rebels in Syria and Turkey, which supports some of the rebels — a potential turning point in a civil war that has lasted nearly six years and claimed hundreds of thousands of lives.
The announcement follows the retaking of all of Aleppo, once Syria’s industrial capital and a stronghold of the opposition, by forces loyal to President Bashar al-Assad, and negotiations in Moscow that involved Mr. Assad’s government, Russia, Turkey and Iran — but, pointedly, not the United States.
Russia’s president, Vladimir V. Putin, said that Russia and Turkey would guarantee the truce, which is set to begin at midnight on Thursday. The Syrian military said minutes later that it had agreed to a nationwide cease-fire starting at midnight.
Mr. Putin said that Mr. Assad’s government and the opposition would hold peace talks in Kazakhstan, but he did not announce a date.
The Russian defense minister, Sergei K. Shoigu, said the truce would include 62,000 opposition fighters across Syria, and that the Russian military had set up a hotline with its Turkish counterpart to allow immediate communication about the truce and whether it was being met.
In a brief statement, the Syrian Army said the cease-fire came “after the victories and successes that our armed forces accomplished in more than one place,” an allusion to the recent seizing by government forces and their militia allies of the entire city of Aleppo.
Not included in the cease-fire are the fighters of the Islamic State, who control territory in eastern Syria and across the border with Iraq, the Syrian affiliate of Al Qaeda, which is strongest in the country’s northwest, and “groups linked to them.”
It was not immediately clear which of the scores of rebel groups scattered across Syria had agreed to the cease-fire, nor whether those that had not been consulted would abide by it. Throughout the war, rebel forces have failed to form a united leadership, and infighting among groups has been common.
It was also unclear what criteria the Syrian military and its Russian allies would use to define groups “linked” to the jihadists. In the past, they have dismissed much of the armed opposition as “terrorists” who could not be distinguished from jihadist groups.
The cease-fire agreement appeared to reflect the changed geopolitical reality since Donald J. Trump’s election as president of the United States. Mr. Trump has called President Obama’s Syria policies a failure and has backed the removal of remaining support for Syrian rebels, vowing to make fighting terrorism virtually the entirety of his administration’s Syria policy.
Mr. Assad has called Mr. Trump “a natural ally” in that fight, and the Russian foreign minister, Sergey V. Lavrov, said on Thursday that Mr. Trump’s administration would be welcome to join the Syrian peace process once he takes office on Jan. 20.
The foreign minister, Mevlut Cavusoglu, told the Turkish news channel A Haber on Thursday that Turkey would guarantee rebel compliance with the cease-fire agreement, while Russia would guarantee adherence by Mr. Assad’s government. Iran would also help monitor compliance by Mr. Assad’s government and by allied Shiite militias, including Hezbollah, he said.