Iran has been a staunch ally of Syrian President Bashar al-Assad since the start of the 32-month-old uprising against him, while Turkey has been one of his fiercest critics, supporting the opposition and giving refuge to rebel fighters.
"Sitting here together with the Iranian foreign minister you can be sure we will be working together to fight these types of scenarios which aim to see a sectarian conflict," Turkish Foreign Minister Ahmet Davutoglu told a conference in Istanbul.
Iranian Foreign Minister Mohammad Javad Zarif, who held talks with Turkish President Abdullah Gul in Istanbul and was due to meet Prime Minister Tayyip Erdogan later in Ankara, echoed the comments, saying that sectarian unrest posed an even greater risk than the use of chemical weapons.
"I believe sectarian conflict is even a greater threat and it is not confined to one region," Zarif said.
"If the flames of sectarianism rage in the Middle East, you will see the results in the streets of London,New York, Rome and Madrid," he told the conference.
While deep divisions remain between Ankara and Tehran over the conflict in Syria, particularly over the role of Assad in any transitional government, diplomats and government officials say both sides want to mend a relationship which could be key to wider diplomatic efforts towards a solution.
"Both Iran and Turkey are at a point where they think they can work together on Syria," a senior Turkish official said.
"Both countries believe the situation needs an urgent solution. But the big question is how," he told Reuters.