Turkish Prime Minister Binali Yildirim attends a funeral ceremony after a terror attack in Istanbul. (Getty)
Turkish Prime Minister Binali Yıldırım paid a two-day visit to his Iraqi counterpart Haider Al-Abadi over the weekend in the attempt to restart a dialogue after relations between the two countries worsened in the last few months.
In a joint press statement, Al-Abadi requested Turkey to gradually withdraw his troops and Yildırım confirmed the commitment.
After a round of talks, the two countries have agreed to: boost their mutual effort to fight terrorism, respect each side's sovereignty, join efforts in post-war reconstruction, and resume all the investments they stopped due to the conflict. They also signed common water management projects.
The two heads of state also discussed the presence of a 500-soldier Turkish contingent on Iraqi soil, which was at the root of the diplomatic standstill.
In October 2016, Turkey repeatedly insisted on deploying its soldiers for the Mosul offensive, in Iraq, claiming it was their right to fight terrorists. The Iraqi prime minister denied authorisation, pointing out that their presence on its soil was a violation of Iraq's sovereignty. Ankara replied to the accusation, saying their troops entered the country on the Kurdistan Regional Government's invitation.
After a tough blame game, the two countries recalled their ambassadors and relations have been frozen ever since.
Yildrim's visit is not only about the two countries, it is part of a larger effort his country is taking to regain its powe in West Asia in a moment when it risks becoming isolated and vulnerable.
The massive purge and the round of arrests after the failed coup d'état in July 2016 cost the country much of its international support. Several terror attacks have hit Turkey since, killing tens of citizens. The Russian ambassador was murdered in cold blood in front of the world's eyes. Kurdish autonomist organisations resumed the fight in the southeastern provinces after a fragile ceasefire broke. Iran and Lebanon are using all their influence to send money and weapons to Shia militias fighting terrorist organisations in both Iraq and Syria, a strategic move which indirectly expands their sphere of influence. Syrian President Bashar al-Assad, heavily backed by Russia, is regaining momentum and he is a man Turkey has never perceived as a plausible ally. The US is providing air support to the Kurdish People's Protection Units (YPG), an organisation Ankara labels terrorists.
The fear of isolation is probably the main reason behind Turkey's decision to send troops directly within Syrian borders to attack the Islamic State.
Turkey-backed militias and the country's regular troops are now fighting in the vicinity of the Syrian town of Al Bab, some 40 kilometres from Aleppo.
The country had not played an active role in Syria until late August 2016, when they launched operation Euphrates Shield with the aim to close and secure the last 95 kilometres of border still under terrorist control. Many have accused Turkey of not having done enough to retake such a minor part of its border, through which IS terrorists, weapons and oil passed for five years.
Fighting the Islamic State is not Turkey's only aim in Syria though. President Erdogan has repeatedly declared his intention to stop the activities of the US-backed Kurdish and Arab Syrian Democratic Forces (SDF) who are fighting boots-on-the-ground against the IS in northern Syria. The Kurdish People Protection Units (YPG) are the backbone of the SDF forces, and Turkey is staunchly opposed to any semi-autonomous Kurdish region in Syria, whatever the cost.
This last intention will probably involve directly the Kurdistan Workers party (PKK), an organisation fighting a three-decade war against Turkey, now headquartered on the Qandil mountains in Iraqi Kurdistan.
Recovering diplomatic and economic relations with Iraq could turn out to be vital for Turkey to get back on track in West Asia, where Iran is currently becoming the strongest regional actor.