By Daren Butler and Ahmed Rasheed
ISTANBUL/BAGHDAD (Reuters) - President Tayyip Erdogan declared on Friday he would not bow to Iraqi demands he withdraw Turkish troops from a camp close to the Islamic State-held city of Mosul, and Baghdad said it would ask the U.N. Security Council to order them to leave.
A row over the deployment has soured relations between Ankara and Baghdad, which denies having agreed to it. Ankara says the troops were sent as part of an international mission to train and equip Iraqi forces to fight Islamic State.
The latest comments indicated continuing tensions despite the Turkish prime minister's office saying agreement was reached in talks with Iraq to deepen security cooperation and "reorganize" military personnel at the Bashiqa camp.
"There is no way we can withdraw our soldiers from northern Iraq now," Erdogan told a news conference. "There was a deployment, not for combat, but to protect soldiers providing training there."
"We will continue the training process decisively," he said.
Turkish military are helping to train local Iraqi volunteers and Kurdish peshmerga who are preparing for a long-anticipated offensive to retake Mosul - a major northern city seized by Islamic state over a year ago.
In Baghdad, Iraqi Prime Minister Haider al-Abadi instructed his foreign ministry to lodge a formal complaint at the U.N. Security Council over the presence of the Turkish forces, asking it to order Turkey to withdraw its troops from Iraq immediately.
Erdogan said in an interview with Al Jazeera that the complaint was not an "honest step".
"They can resort to the U.N. Security Council, that is their natural right, but this is not an honest step and we believe that Iraq's actions are related to the latest developments in the region, that is, the steps taken by Russia and Iran.
"I believe that the Security Council at the United Nations knows that this step is not honest and will issue its decision accordingly," he said.
Earlier, Iraq's top Shi'ite cleric, Grand Ayatollah Ali al-Sistani, urged the government to show "no tolerance" for any infringement of the country's sovereignty. Sistani's spokesman, Sheikh Abdul Mehdi Karbala'i, did not explicitly name Turkey.
Sistani also said Iraq's neighbors should not send any troops to Iraq "under the pretext of fighting terrorism", except with the approval of the Baghdad government.
"The Iraqi government is responsible for protecting Iraq's sovereignty and must not tolerate any side that infringes upon on it, whatever the justifications and necessities," Karbalai'i said in a weekly sermon.
Sistani urged citizens to show restraint toward foreign residents of Iraq, after Shi'ite paramilitary groups threatened to use force against Turkey and target its interests to force it to pull out.
In Ankara, Prime Minister Ahmet Davutoglu's office said in a statement that Turkey had decided in talks with Iraqi officials to "reorganize" its military personnel at the Bashiqa camp
Turkey's Foreign Ministry Undersecretary Feridun Sinirlioglu and National Intelligence Agency (MIT) head Hakan Fidan visited Baghdad on Thursday for talks with Abadi on the issue.
"Taking into account the Iraqi government's sensitivity, the decision was taken to reorganize the military personnel in the protection force at the Bashiqa camp," Davutoglu's office said.
It did not say what the troop reorganization would involve, but said agreement was reached to start work on creating mechanisms to deepen cooperation with the Iraqi government on security issues.
Davutoglu said on Wednesday the soldiers were sent to northern Iraq after a threat from Islamic State militants to Turkish military trainers in the area increased.
(Reporting by Tulay Karadeniz, Ercan Gurses and by Tom Finn in DOHA; Writing by Daren Butler; Editing by Nick Tattersall, Ralph Boulton and Louise Ireland)