MOSCOW -- Russian President Vladimir Putin said a Syrian cease-fire agreement had been reached with Turkey.

Putin said Thursday that Russia and Turkey would guarantee the truce, which is set to begin at midnight local time. He said it would be followed by peace talks between Syrian President Bashar Assad’s government and the opposition, and that the Syrian parties would take part in talks to be held in Kazakhstan, without specifying a date.

U.N. envoy for Syria Staffan de Mistura welcomed the agreement, saying he hoped it would pave the way for “productive” talks between the parties to the country’s civil war. In a statement, de Mistura’s office said, “The special envoy is of the view that these developments should contribute to inclusive and productive intra-Syrian negotiations to be convened under U.N. auspices on Feb. 8, 2017.”

Syria’s military said it had agreed to the nationwide cease-fire starting at midnight. It said the agreement came after the “successes achieved by the armed forces,” an apparent reference to the capture of rebel-held neighborhoods of Aleppo earlier this month.

Get Breaking News Delivered to Your Inbox

A spokesman for the main moderate Syrian opposition groups said they had also agreed. Osama Abu Zeid told reporters in Turkey that 13 armed opposition factions had signed the five-point agreement. He said the talks would be based on the Geneva 2012 declaration that called for a transitional governing body with full executive powers to run affairs in Syria during the transitional period, which “means that there will be no presence for (President Bashar) Assad in the future.”

Putin said at a meeting with the heads of the Russian Foreign Ministry and the Russian Defense Ministry early Thursday that he had “just got the message that today a few hours ago, an event occurred which we have not just waited a long time, but the approach which worked.”

Putin noted that the agreement on the Syrian cease-fire was very fragile and would require special attention.

Turkey considered the cease-fire “an important step to resolve the Syrian conflict,” Turkish President Recep Tayyip Erdogan’s spokesman Ibrahim Kalin said Thursday.

“The arrangement aims to expand the cease-fire in Aleppo to other parts of Syria, secure uninterrupted humanitarian assistance and revitalize the political process,” Kalin said.

Turkey’s Foreign Ministry said groups regarded as terror organizations by the U.N. Security Council would be excluded from the cease-fire, apparently referring to the Islamic State of Iraq and Syria (ISIS) group and the al-Qaeda-linked Fatah al-Sham Front. It said the government and the opposition had agreed to halt attacks, including aerial attacks, and not to expand territories under their control in ways that would be detrimental to one other.

Russian Defense Minister Sergei Shoigu said the truce would include 62,000 opposition fighters across Syria, and that the Russian military had established a hotline with its Turkish counterpart to monitor compliance.

Excerpts of the cease-fire agreement that were obtained by The Associated Press (AP) news agency said the cease-fire would include the eastern suburbs of the capital Damascus, and that it would cover all areas where the “moderate opposition” had a presence, including those where al-Qaeda’s branch in Syria exists. It also said that the opposition would be given the right to name its delegation to peace talks in the Kazakh capital of Astana.

AP also reported that the talks would begin within a month from the time the cease-fire went into effect.

Russian Foreign Minister Sergey Lavrov said that President-elect Donald Trump’s administration would be welcome to join the Syrian peace process once he takes office.

Meanwhile, Russian war planes targeted ISIS in northern Syria, providing support to a Turkish offensive there, Turkish media reported. The pro-government Sabah newspaper and other media said Thursday that Russian jets bombed ISIS targets in the al-Bab region late on Wednesday. If confirmed, it would mark the first instance of Russian support to the Turkish operation in northern Syria.

Russia is a key ally of Assad, while Turkey is one of the main backers of the opposition. Several previous attempts to halt the civil war have failed.