Iranian President Hassan Rohani has vowed his country will back Syrian President Bashar al-Assad until the end.

Official Iranian media said Rohani made the remark on June 2 during a visit to Tehran by Syria's parliament speaker, Mohammad al-Laham.

The meeting follows major gains by armed opposition factions in Syria in recent weeks. Last month, Islamic State fighters seized control of the ancient city of Palmyra in central Syria.

Shi'ite power Iran has backed Assad and his father since long before the conflict began in Syria in 2011.

Commentators say as Sunni jihadist factions have become more prominent in the conflict, Assad's government and Iran have portrayed the Syrian opposition as terrorists backed by regional Sunni countries.

"Unfortunately, some countries in the region have miscalculated and think they can use terrorist groups to pursue their goals, but sooner or later terrorism will be upon them," Rohani was quoted as telling Laham.