Baghdad: Iraq’s Prime Minister Haider Al Abadi said on Saturday an agreement had been reached with Turkey over an Iraqi demand that Turkish forces withdraw from a town near Mosul in the north of the country, Iraqi state TV reported.

Al Abadi met his Turkish counterpart Binali Yildirim in Baghdad. State television did not provide further details about the agreement over the town of Bashiqa, where Turkish forces have been stationed since before a recent offensive against Daesh in northern Iraq.

It said Turkey had pledged to “respect the sovereignty of Iraq” and that Baghdad and Ankara agreed not to interfere in each other’s domestic affairs.

Iraq and Turkey came to blows in October over the continued presence of Turkish forces in Bashiqa and elsewhere in northern Iraq, with each government summoning the other’s ambassador just as the US-backed campaign to drive Daesh out of Mosul was set to begin.

It meeting was first such visit since the two governments quarreled over the presence of unauthorised Turkish troops in northern Iraq, straining relations between the two neighbors.

On his Twitter account, the Turkish Ambassador to Baghdad, Faruk Kaymakci, said that “We hope that his visit will open a new chapter in Turkey-Iraq relations.”

The presence of some 500 Turkish troops in the Bashiqa region, northeast of the Daesh-held city of Mosul, has stirred tension with Baghdad since late last year. Iraq has demanded their withdrawal, saying they are there without permission and are in “blatant violation” of Iraqi sovereignty. Turkey says the troops were invited by local Iraqi authorities and has ignored the calls.

The issue has led to a war of words between the two nations’ leaders as Iraqi government troops launched a massive military operation to recapture Mosul on Oct. 17. Ankara has insisted that its forces should take part in retaking the city, but Baghdad has refused.

The issue of the Turkish forces in Bashiqa grew into a rare and bitter public feud last year between Turkish President Recep Tayyip Erdogan and Iraqi Prime Minister Haider Al Abadi.

At one point, Erdogan gave a speech telling Al Abadi to “know his place,” and adding, “you are not at my level, you are not my equivalent, you are not of the same quality as me.”

Al Abadi responded by mocking Erdogan’s use of a video messaging app during Turkey’s failed coup last year.

An Iraqi court later issued an arrest warrant against the former governor of Ninevah province, of which Mosul is the capital, Atheel Al Nujaifi, accusing him of facilitating the entry of the Turkish forces. The troops have trained Sunni fighters loyal to Al Nujaifi and Kurdish forces loyal to Kurdish leader Masoud Barzani - who both have sought greater power away from the Shiite-led central government in Baghdad.