Syria's President Bashar al-Assad has visited Moscow on his first overseas trip since the civil war broke out in his country in 2011.
During the surprise visit, he had talks with President Vladimir Putin.
Russia launched air strikes in Syria last month against the so-called Islamic State (IS) and other militant groups battling Mr Assad's forces.
Mr Assad said Russia's involvement had stopped "terrorism" becoming "more widespread and harmful" in Syria.
For his part, Mr Putin said Moscow's hope, in providing a "positive dynamic in the fighting", was that a "long term resolution can be achieved on the basis of a political process with the participation of all political forces, ethnic and religious groups".
The visit happened on Tuesday evening, but was not announced until Wednesday - after Mr Assad had returned to Damascus.
The BBC's Steve Rosenberg in Moscow says this was a short visit but by hosting the Syrian leader, President Putin's message to the West was clear - that Moscow is a key player in the Middle East, and that there can be no solution to the Syrian conflict without Russia's involvement.
Analysis: Diplomatic correspondent Jonathan Marcus
President Assad's surprise visit to Moscow represents a sign of growing confidence by the embattled Syrian president. He feels it safe to leave Damascus for the first time since the civil war in Syria erupted.
It is also a visible symbol of Russia's confidence in the current Syrian regime. Having Mr Assad turn up in Moscow shows that there is little doubt that for now at least, President Putin is intent on shoring up Mr Assad's position.
But the trip may also mark a new stage in Russia's efforts to roll out a diplomatic plan alongside its military intervention in Syria; an illustration that Russia deals with Mr Assad, and that for now at least Mr Assad has to be part of any interim solution.
In comments that were videoed and published by the Kremlin, Mr Putin thanked Mr Assad for coming despite the "dramatic situation" back home.
He praised the Syrian people for "almost alone... resisting, fighting international terrorism for several years. They had suffered serious losses, but recently have been achieving serious results in this fight," he added.
Mr Putin said Russia was also concerned by the 4,000 people from the former Soviet Union believed to be fighting in Syria. "We cannot permit them - once they get fighting experience there and ideological training - to turn up here in Russia," he said.
Mr Assad thanked Russia for "standing up for the unity of Syria and its independence", and said its intervention had "prevented the events in Syria from developing along a more tragic scenario".
Terrorism is a "real obstacle to a political solution," said Mr Assad, "and of course the whole (Syrian) people want to take part in deciding the fate of their state, and not just the leadership."
Russia launched air strikes in Syria on 30 September, saying they were hitting IS positions - which are also being targeted by US-led strikes.
Western countries and Syrian activists say Russian planes have been hitting non-IS targets, a claim Moscow denies.
The US and Russia agreed a deal on Tuesday to ensure their air forces do not clash in the skies over Syria, after Washington said last week their planes had "entered the same battle space" and came within miles of each other.
In the wake of Mr Assad's visit, the Kremlin announced that Mr Putin had spoken by telephone with Turkish President Recep Tayyip Erdogan and Saudi King Salman.
In further Syria-related diplomacy, Russian media also reported that US Secretary of State John Kerry would meet his Russian counterpart Sergei Lavrov in Vienna on Friday, and that the Turkish and Saudi foreign ministers would join them.
Why is there a war in Syria?
Anti-government protests developed into a civil war that, four years on, has ground to a stalemate, with the Assad government, Islamic State, an array of Syrian rebels and Kurdish fighters all holding territory.
Who is fighting whom?
Government forces concentrated in Damascus and the centre and west of Syria are fighting the jihadists of Islamic State and Jabhat al-Nusra, as well as less numerous so-called "moderate" rebel groups, who are strongest in the north and east. These groups are also battling each other.
What's the human cost?
More than 250,000 Syrians have been killed and a million injured. Some 11 million others have been forced from their homes, of whom four million have fled abroad - including growing numbers who are making the dangerous journey to Europe.
How has the world reacted?
Iran, Russia and Lebanon's Hezbollah movement are propping up the Alawite-led Assad government, while Turkey, Saudi Arabia and Qatar back the more moderate Sunni-dominated opposition, along with the US, UK and France. Hezbollah and Iran are believed to have troops and officers on the ground, while a Western-led coalition and Russia are carrying out air strikes.