BAGHDAD (AP) " Just days into the operation to retake the Islamic State-held city of Mosul, a fault-line has widened between Iraq and Turkey, and the distrust among the various forces arrayed against the extremists has again bubbled to the surface.
The rhetoric is growing increasingly heated on both sides. Iraqi Prime Minister Haider al-Abadi and Turkish President Recep Tayyip Erdogan have traded schoolyard insults, and earlier this week thousands of followers of a firebrand Shiite cleric rallied outside the Turkish Embassy in Baghdad, calling for an end to the Turkish "occupation."
They were referring to the presence of some 500 Turkish troops at a base north of Mosul who have been training Sunni and Kurdish fighters since last December. Baghdad says the troops are there without permission and has called on them to withdraw. Ankara has refused, and insists it will play a role in liberating the city.
Turkey has close ties to the Kurdish leader Masoud Barzani, which perhaps explains how the troops came to be there in the first place. Kurdish Foreign Minister Falah Mustafa declined to comment Wednesday when asked if the Kurds had invited the troops, saying only that they favor a solution that is "satisfactory" to both countries.
The Turkish troops are training Kurdish forces loyal to Barzani as well as Sunni fighters loyal to Atheel al-Nujaifi, the former governor of Ninevah province, of which Mosul is the capital. Both men have pursued greater autonomy from the Shiite-dominated government, incurring the wrath of state-sanctioned Shiite militias backed by Iran. An Iraqi court issued an arrest warrant against al-Nujaifi this week, accusing him of facilitating the entry of unauthorized Turkish forces.
Now all the various groups are gathered around Mosul, hoping to take part in the biggest military offensive Iraq has launched since the 2003 U.S.-led invasion.
"It's not just an issue of sovereignty," said Baghdad-based analyst Hadi Jalu Maraei. "This intervention has a negative effect on the whole region because there are so many ethnic groups and sects."
Turkey has historic ties to Mosul that go back centuries, and sees itself as its protector because of the city's Sunni majority and large ethnic Turkmen community, said Fadi Hakura, a Turkey analyst at Chatham House.
"Turkey fears that the Shiite-dominated central government in Baghdad will alter the demographic balance after the ejection of the Islamic State from the city," he said.
Turkey's allies point to the Iraqi government's strong ties to Ankara's regional rival, Iran, which has no known military forces in the country but sponsors several powerful militias.
"It is true that Turkey is stepping into a foreign country, but it is also true that some of the Iraqi actors have strong links to regional powers," said Maria Fantappie, an Iraq researcher at the International Crisis Group. "So how to draw the line between what is Iraqi and non-Iraqi? It's kind of difficult."
Turkey has also deepened its involvement in the war in neighboring Syria, where Turkish forces and allied Syrian opposition fighters are battling both IS extremists and U.S.-backed Syrian Kurdish forces.
Turkish warplanes struck Kurdish forces in northern Syria late Wednesday, killing up to 200 fighters, according to state-run media. Turkey views the Syrian Kurdish forces as an extension of the Kurdish insurgency in its southeast. A commander of the main Kurdish militia in Syria said initial reports indicated that no more than 10 fighters were killed, but added that the Turkish attacks were still continuing Thursday.
In a speech earlier Wednesday, Turkish President Recep Tayyip Erdogan addressed his troops' presence in Iraq, saying "our position has nothing to do with war-mongering, with the violation of Iraq's sovereignty or any other ulterior motive."
"We want to be present wherever we need to be, to protect our freedom and future," he said. "That place at the moment is Mosul " therefore we will be in Mosul."
He had struck a far more vitriolic tone last week, when he told Iraqi Prime Minister Haider al-Abadi to "know his place."
"You are not my interlocutor, you are not at my level, you are not my equivalent, you are not of the same quality as me," Erdogan said. "Your screaming and shouting in Iraq is of no importance to us. You should know that we will go our own way."
Al-Abadi responded by mocking Erdogan's use of a video messaging app during Turkey's failed coup earlier this year.
The perceived affront to Iraq's sovereignty, and the war of words, has put al-Abadi in a difficult position. His Shiite base is demanding action, and his political rivals can point to the presence of the Turkish troops as a sign of the government's weakness.
At the demonstration on Tuesday, followers of Shiite cleric Moqtada al-Sadr called for the Turks to be driven out, by force if necessary.
At the same time, al-Abadi can scarcely afford an open conflict with a powerful neighbor when his forces are trying to liberate the country's second largest city from IS. Iraqi and Turkish officials have been holding talks in recent days to resolve the crisis, but al-Abadi told reporters Tuesday that they had yet to reach an agreement.
In part to prevent further tensions, the government has said that neither the peshmerga nor the Shiite militias will enter the city of Mosul itself, leaving the urban fighting to the army and federal police.
Abu Mahdi al-Muhandis, who heads the Popular Mobilization Units, an umbrella group of mostly Shiite militias, said Tuesday that he would abide by the government's decision to resolve the conflict with Turkey diplomatically.
"That was his way of saying they won't attack the Turkish base directly," said Kirk Sowell, publisher of the biweekly newsletter Inside Iraqi Politics. "They may shell them a bit though."
He said al-Nujaifi's Sunni militia is likely to prove more problematic.
"It would kill al-Abadi politically if al-Nujaifi were able to stage some heroic ride back into Mosul as the basis for his campaign to return to office after the next provincial elections. Shia widely view Turkey as a terror sponsor, and al-Nujaifi is Turkey's main Sunni Arab proxy in Iraq. So you can do the math."
Associated Press writer Suzan Fraser in Ankara, Turkey contributed to this report.
Follow Joseph Krauss on Twitter at www.twitter.com/josephkrauss
This story has been automatically published from the Associated Press wire which uses US spellings