MOSCOW -- On a surprise trip to Russia, Syria's Bashar Assad discussed potential new peace initiatives for post-war Syria with Russian President Vladimir Putin who declared that Russia's two-year military campaign in Syria is wrapping up, the Kremlin said Tuesday.

Moscow released footage of Assad warmly embracing Putin, who hosted him in the Black Sea resort of Sochi on Monday, ahead of a summit between Russia, Turkey and Iran and a new round of Syria peace talks in Geneva later this month.

The meeting was unannounced and the Kremlin did not make it public until Tuesday morning.

"I passed on to (Putin) and all Russian people our greetings and gratitude for all of the efforts that Russia made to save our country," Assad told Russia's top brass in televised remarks.

Assad has only ventured outside his war-ravaged nation twice since the conflict began -- both times to Russia. This week's visit to meet Putin is his second since the crisis began in March 2011 leading to a civil war that has killed some 400,000 people and resulted in millions of refugees.

The first was in October 2015, weeks after Russia launched its military campaign in Syria to shore up Assad's forces, which turned the war in favour of Assad.

The meeting in Sochi, which lasted three hours, preceded a summit between the presidents of Iran, Russia and Turkey set for Wednesday at the same venue. Iran and Russia have been Assad's main backers while Turkey supports the opposition.

Putin's spokesman Dmitry Peskov said the Russian president had previously assured the leaders of Turkey and Iran that "Russia will work with Syrian leadership to prepare the groundwork for the understandings that could be reached in Sochi on Wednesday and to make sure that agreements that could be reached would be viable."

It wasn't immediately clear if the Kremlin put any pressure on Assad to accept a new deal brokered by Russia, Turkey and Iran -- or whether that deal would involve Assad staying on as president once the war is over -- but Assad signalled his intention to hold his ground in future Syria peace talks.

"We count on Russia's support to keep foreign players from interfering into the political process," he said during the talks with Putin. Assad is believed to have left Sochi after the meeting and returned to Damascus.

Asked whether Putin and Assad have talked about the Syrian president's future in post-war Syria, Peskov said "possible options for political settlement have been discussed" and added that "only the Syrian people could determine Assad's role."

Despite pressure from other nations that Assad step down, Moscow has insisted that it is up to the Syrian people to vote him in or out.

Putin later called President Donald Trump to inform him about the talks with Assad, emphasizing that the Syrian leader said he would abide by a political settlement for Syria, including constitutional reform and the holding of parliamentary and presidential elections.

Putin also called Saudi King Salman to inform him of the main issues on the agenda of the Russia-Turkey-Iran talks on Wednesday. They also discussed "long-term prospects for a Syrian settlement," according to the Kremlin. Putin noted that Syria talks planned in Sochi and a meeting of Syrian opposition in Riyadh should help future talks in Geneva.

The Russian leader also later phoned Israeli Prime Minister Benjamin Netanyahu and the Egyptian President Abdel-Fattah el-Sissi to brief them on the talks with Assad and the planned trilateral meeting.

To prepare for Wednesday's mini-summit, military chiefs of Russia, Turkey and Iran met in Sochi on Tuesday and agreed to co-ordinate their efforts in Syria.

Russia's defence ministry said the military chiefs discussed "concrete steps to complete the elimination of the remaining IS and Nusra Front formations" in Syria, referring to Islamic State fighters and Syria's al-Qaida affiliate as it was formerly known. The three also agreed to improve co-ordination in a safety zone in Syria's northwestern Idlib province.

Russia, Turkey and Iran earlier this year brokered a truce between Syria's government and the rebels in four areas, including in Idlib.

On Sunday, Syrian troops and their allies captured the eastern town of Boukamal, the last major urban area held by the Islamic State group in Syria, leaving the militants to defend just strips of desert territory and a besieged pocket outside Damascus.

With the Syrian government controlling most of the country and Islamic State fighters in disarray, Putin said during the talks with Assad that Russia's military campaign in Syria is wrapping up -- though he made no mention of the Russian presence in Syria, which Moscow is not likely to give up.

"As for our joint work to fight terrorists in Syria, this military operation is coming to an end," he told Assad in televised remarks. "I note with pleasure your willingness to work with everyone who wants peace and settlement."

Gen. Ret. Viktor Bondarev, former Russian air force chief who heads the defence affairs committee in the upper house of Russia's parliament, was quoted by the Tass news agency as saying that the military will keep its warplanes, as well as some ground troops and weapons in Syria.

Russia has used the Hemeimeem air base in Syria's province of Latakia as the main hub for its campaign. It also has a naval supply facility in Tartus, which it plans to expand into a full-fledged naval base.

Putin declared in March 2016 that Moscow will scale down its presence in Syria, but the Russian military has remained heavily involved in the conflict.

Russian television showed footage of Putin and Assad entering a meeting with the top brass of Russia's defence ministry and the General Staff.

"I asked the Syrian president to stop by," Putin told the Russian generals. He then referred to Assad and said: "I would like to introduce you to people who played a key role in saving Syria."

------

Mroue reported from Beirut. Associated Press writer Vladimir Isachenkov in Moscow contributed to this report.