Both leaders also discussed the situation in the Persian Gulf after top Iranian general Qasem Soleimani was killed in a USA airstrike last week and called for resolving rising tensions peacefully.
Since the killings, rival Shia political leaders in Iraq have called for USA troops to be expelled from the country in an unusual show of unity among factions that have squabbled for months.
Similarly, Israeli Prime Minister Benjamin Netanyahu, said on Wednesday, after an Iranian missile strike on US -led forces in Iraq, that Israel would hit back hard against anyone who attacked his country.
The Syrian government has largely won almost 9-year-old civil war militarily, and has retaken control of most of the country from rebel fighters.
Iranians mass for funeral in hometown of general killed by US
The friction is rooted in the 2018 U.S. decision to withdraw from a nuclear deal signed in 2015 between Iran and world powers. President Donald Trump's assertions that he would bomb Iranian cultural sites despite global prohibitions on such attacks.
"In light of the ballistic missile attacks by Iran against coalition military bases in Iraq on [Tuesday], we believe that exchange of attacks and use of force by any party do not contribute to finding solutions to the complex problems in the Middle East, but rather would lead to a new cycle of instability and would eventually damage everyone's interests", the two leaders said in a joint statement.
"I think Putin is there to reinforce the Russian position in Syria and with the person of Syrian President Bashar al-Assad, especially as Iran's position has been indelibly weakened, since Soleimani was essentially Iran in Syria", said David Lesch, an expert on Syria.
"In his conversation with Assad, Putin noted that we can now say with confidence that a huge distance has been travelled towards restoring Syrian statehood and the country's territorial integrity", said Kremlin spokesman Dmitry Peskov.
To make that point, Putin and Assad visited the Syrian capital's landmark Umayyad Mosque in the walled Old City together, where he viewed the tomb of John the Baptist who is sacred to both Christians and Muslims.
Through TurkStream, Russia's gas giant Gazprom will carry pipeline gas to Turkey and south and southeastern Europe-a region already heavily dependent on Russian gas supplies. Turkey has supported rebels opposing Assad in the country's eight-year civil war.
Pentagon chief denies U.S. leaving Iraq; Tehran crowds mourn commander
The confusion came amid threats to American forces after the United States killed top Iranian commander Qasem Soleimani . Asked if he could confirm that Gen Seely's letter was authentic, Secretary Esper said: "No, I can't".
In recent weeks, Syrian troops supported by Russian warplanes have been pushing into the country's last rebel stronghold, located in the northwestern Idlib province.
This visit comes at a time of heightened regional tensions.
In December 2017, Mr Putin visited Hmeimim, the Mediterranean base where the largest number of Russian forces is deployed, but had not visited Damascus since the start of the conflict in 2011. Assad previously visited Russian Federation and met with Putin in May 2018, November 2017 and October 2015.
The call came amid a warning by German Foreign Minister Heiko Maas of a Syrian-style civil war in Libya.
Litvinova reported from Moscow.
Job only half done for Guardiola as Man City outclass Man Utd
Despite suffering the problem in the first half, Maguire continued and finished the game. Let us know in the comments section below.