Moscow: Russian President Vladimir Putin declared victory against “terrorists” in Syria on Monday during a surprise visit to a Russian military base in the county, where he also announced a partial pullout of Russian troops.

It was Putin’s first trip to Syria, where Russia launched an air campaign in 2015 that allowed President Bashar Al Assad’s forces to gain the upper hand against Daesh as well as Syrian rebels. It was also the first visit by a foreign head of state to war-ravaged Syria since the civil war began in 2011.

Putin’s brief stop at the Hemeimeem airbase in Syria’s coastal province of Latakia while en route to Egypt came days after the Russian president said he would run for re-election on March 18, and helped to show off Moscow’s global clout to the national audience.

In a televised speech to the Russian troops at the base, Putin hailed their “excellent” performance in Syria, where the Russian military declared victory against Daesh last week.

“You have shown the best qualities of a Russian soldier — courage, valour, team spirit, decisiveness and excellent skills,” he said. “The Motherland is proud of you.”

Russia launched its air campaign in Syria at the end of September 2015, when Al Assad’s regime was teetering on the brink of collapse, and quickly changed the course of the conflict. Russian officials say the troops were sent to Syria mainly to fight “terrorists,” including Daesh and Al Qaida, but they also battled mainstream rebels opposed to the Al Assad family’s four-decade rule.

Putin has hosted Al Assad twice in the past six years, including a surprise November 21 visit that Al Assad undertook to the Black Sea resort of Sochi.

Russian television stations showed Putin walking off the plane at the airbase, embracing and shaking hands with Al Assad. The two then visited a military operations room.

The Hemeimeem base, located in the heartland of Al Assad’s Alawite minority, has served as the main foothold for the Russian military campaign in Syria.

“Here in Syria, far away from our borders, you helped the Syrian people to preserve their state and fend off attacks by terrorists,” Putin said, facing the troops lined up on the tarmac. “You have dealt a devastating blow to those who blatantly threatened our country. We will never forget about the victims who fell in the fight against terror both here and in Russia.”

Putin also said that he had ordered the military to withdraw a “significant part” of the Russian contingent in Syria.

“Friends, the Motherland is waiting for you,” Putin said. “You are coming back home with victory!”

He added, however, that the Russian military will maintain its presence at Hemeimeem and a naval facility in Tartus.

Gen. Sergei Surovikin, the Russian military commander in Syria, said the military will pull out 23 warplanes, two helicopter gunships, special forces units, military police and field engineers.

Surovikin said the remaining forces will be sufficient to “successfully fulfil the tasks” to stabilise the situation in Syria. He did not say how many troops and weapons would stay behind.

Syria has allowed Russia to use Hemeimeem airbase indefinitely without cost. Moscow also has a deal with Syria to use the Tartus base for 49 years, which could be extended if both parties agree.

The Russian military plans to modernise the airbase and expand its runways to allow it to host more warplanes. It also intends to expand the Tartus facility significantly to make it a full-scale naval base capable of hosting warships, including cruiser-sized vessels.

After seeing troops march, Putin drove up to the Russian warplanes parked on the runway and talked to the pilots, who said they will fly back home later in the day.

Syrian TV said Al Assad thanked Putin for his troops’ “effective contribution” to the fight against terrorism in Syria, which he said the Syrian people “will never forget.”

“Syria has been saved as a sovereign, independent state, refugees are coming home and conditions have been created for a political settlement under the United Nations’ auspices,” Putin said.

Insurgents still control several areas in Syria, but much of the fighting has been paused by “de-escalation” agreements brokered by Russia and Iran, which support Al Assad, and Turkey, which backs the rebels.

Putin told Al Assad he would discuss the prospects for a peace settlement with the leaders of Egypt and Turkey later Monday.

“I hope that together with Turkey and Iran we will succeed in restoring peaceful life and launch a political process to settle the situation in Syria,” Putin said.