Iranian President Hassan Rouhani begins a landmark trip to Turkey on Monday as the two countries try to build trade ties despite an often fraught competition for regional influence and deep differences over the Syrian war.

Rouhani will meet his Turkish counterpart Abdullah Gul and Prime Minister Recep Tayyip Erdogan in Ankara, where the powerful neighbors are expected to discuss security concerns as well as trade opportunities.

The two sides have had a complex and often dysfunctional relationship, which has taken an especially bitter turn in recent years as a result of increasing competition between Sunni and Shiite Muslim powers across the region.

This has become more pronounced following the onset of the Syrian civil war, in which the two have found themselves on opposite sides.

Iran, a Shiite theocracy, is the chief backer of Syrian President Bashar Assad, while Sunni-majority Turkey has moved from trying to encourage reform in Syria to overtly supporting the armed opposition.

The two also compete for influence in Iraq, Central Asia and the Caucasus.

Even on areas where they might be thought to cooperate — such as Kurdish separatism — they have often sought to undermine each other. Both Turkey and Iran face a threat from Kurdish rebels who wish to break away and form their own country. But instead of cooperating, the two governments have sponsored rebels in the others’ backyard over the years.

In 2012, Turkish media reported government claims that more than 100 Iranian agents were active in Turkey, working on behalf of the Kurdistan Worker’s Party (PKK) – a Kurdish rebel group that fights for autonomy for Kurds.

“We have agreements as well as disagreements,” was the summation of the Iranian embassy spokesman in Ankara last week.

Energy and trade ties

Despite the tensions, the two sides have many reasons to work together.

Both are concerned about the rise of radical militancy around their borders, and most of all wish to maintain their close energy and trade ties that have been threatened by Western sanctions targeting Iran.

Rouhani will be flanked by a crowded delegation of ministers, with at least six cooperation deals due to be struck.

Iran and Turkey will also chair the first meeting of a high-level cooperation council, a mechanism Ankara has established with its neighbours to promote trade and regional integration.

On a visit to Tehran in January, Erdogan said the two countries were aiming to more than double trade to $30 billion by 2015.

Turkey is also heavily reliant on Iran for oil and gas, having few energy resources of its own. It has been a fierce opponent of Western sanctions that has severely curtailed its access to Iranian fuel in recent years.

Ankara has been accused of circumventing the sanctions by quietly trading gold for Iranian gas.

Turkish prosecutors are currently investigating what they describe as a huge criminal network that used bribes and payoffs to conceal the illicit of trade. Erdogan has dismissed the allegations as a foreign conspiracy plot and put huge pressure on investigators to drop the case.

He hopes Iran will be able to forge a diplomatic deal with the West over its nuclear programme by the deadline of July 20 that would see sanctions — suspended since an interim deal was signed late last year — dropped permanently.

EU foreign affairs chief Catherine Ashton and Iranian Foreign Minister Mohammad Javad Zarif met in Istanbul last month to discuss the next steps towards a final agreement, and another round of talks is scheduled in Vienna for mid-June.

“We always look positively to Turkey hosting nuclear talks,” the Iranian diplomat told AFP, saying that the course of negotiations with Tehran and world powers would be shared with Turkish officials.

Ankara has long defended Tehran’s right to peaceful nuclear technology but adamantly opposes any development of nuclear weapons, which it fears would lead to an arms race in the Middle East.

The last official presidential visit from Iran to Turkey was in 1996 by Hashemi Rafsanjani.

That visit was marked by controversy when Rafsanjani refused to visit the mausoleum of modern Turkey’s revered founder Mustafa Kemal Ataturk — a routine practice for foreign heads of state. Rouhani is also expected to skip the mausoleum.

Ataturk’s secular credentials make him an unpopular figure with Iran’s theocratic rulers. Similarly, Turkey’s president refused to visit the tomb of Iranian revolutionary leader Ruhollah Khomeini during a visit last year.