MOSCOW - President Vladimir Putin made his first visit to Syria on Monday and ordered the partial withdrawal of Russian troops from the war-torn country, saying their task had been largely completed.

Putin, who announced last week he would seek a fourth term in a poll in March, was welcomed at Russia's Hmeimim airbase by Syrian President Bashar al-Assad on the surprise stopover.

The two men were pictured smiling and hugging, with Putin hailing a "significant result of our joint work".

In a televised speech to Russian troops, Putin said he had ordered his Defence Minister Sergei Shoigu to start a partial withdrawal. "I have taken a decision: a significant part of the Russian troop contingent located in Syria is returning home to Russia," he said in a televised speech at the base in Latakia province, a government stronghold.

Russia first intervened in the conflict in 2015, staging air strikes in support of its ally Damascus targeting both the Islamic State group (IS) and other militants as well as rebels fighting government troops. Putin said the troops had helped the Syrian army crush the "most battle-ready group of international terrorists," apparently referring to IS.

"On the whole the task has been completed. And completed brilliantly."

Putin said last month that efforts to end the war were entering a "new stage" as the focus shifted from military intervention to political reforms.

He said both Hmeimim and Russia's naval facility in Tartus would continue to function and warned that Russia would repel any fresh attacks by militants.

"If terrorists rear their heads again we will inflict the blows that they have not seen yet," he said.

The Pentagon on Monday voiced skepticism about Russian President Vladimir Putin’s announcement that he had ordered the partial withdrawal of troops from Syria.

Pentagon spokesman Major Adrian Rankine-Galloway said such declarations were not necessarily reflected by action. “Russian comments about removal of their forces do not often correspond with actual troop reductions, and do not affect US priorities in Syria,” he said.

The European Union warned Monday that the war in Syria was “still ongoing” and civilians were being attacked, after President Vladimir Putin announced the partial withdrawal of Russian troops, saying their work was largely done.

EU diplomatic chief Federica Mogherini said the bloc was ready to do whatever was needed to support UN-brokered peace efforts, but warned the idea that “things can go back to normal unfortunately has no real ground”. “Conflict is still ongoing, even if some wish to pretend it is over,” she told reporters in Brussels.

“We know very well that on the ground fighting is still going on, civilians are still attacked and we see that with our humanitarian support every single day inside Syria.”

Putin made the Syria stopover, the first by a Russian head of state since then president Dmitry Medvedev visited in 2010, en route to Egypt where he arrived later Monday.

From there, Putin is scheduled to travel to Turkey for talks with President Recep Tayyip Erdogan.

The Kremlin strongman thanked the troops for defending Russia from terrorism and helping Syria remain a "sovereign independent state".

He said the conflict proved that Russia's armed forces, including intelligence officers, pilots, sailors, special forces, military police, sappers and military advisers, were on top form, and he also praised the country's defence industry.

"Our homeland thanks you, my friends," he said. "Have a safe trip. I thank you for your service."

Putin also inspected the troops who goose-stepped to the tune of a popular Soviet-era song about World War II, and held talks with Assad. The Syrian leader expressed his "deep gratitude" for Russia's role in the conflict.

"The Syrians will never forget what the Russian forces did," official Syria media quoted him as saying.

"Their blood mixed with the blood of the martyrs of the Syrian army. This means that this blood is stronger than terrorism and its mercenaries."

Putin said he would discuss Russia's efforts to convene Syria's political congress with the leaders of Egypt and Turkey, and then brief Assad.

Last month, Putin welcomed Assad for a surprise summit at his residence in the Black Sea resort of Sochi.

Last week Putin announced he would be standing in the March presidential election that he is expected to effortlessly win, and his lightning visit to Syria can be expected to play well with the voters.

The commander of Russia's forces in Syria, Sergei Surovikin, said 23 Russian planes, two helicopters and military police would be returning to Russia soon, national television reported.

The first jets were scheduled to leave Monday. The size of the Russian deployment in Syria is not known but independent Russian military expert Pavel Felgenhauer has told AFP that up to 10,000 troops and private contractors could have taken part in the conflict.

Putin had ruled out dispatching ground forces in Syria, making the air force the mainstay of Moscow's Syria campaign.

Around 40 Russian servicemen have reportedly been killed in Syria since Moscow's intervention. The Kremlin has acknowledged some of those deaths.

But the losses may be higher given the number of Russian troops and mercenaries believed to be in the country, observers say.

More than 340,000 people have been killed since the conflict broke out in March 2011 with protests against Assad's rule that sparked a brutal crackdown.