BAGHDAD/ANKARA (Reuters) - Turkey said on Sunday it would halt further transfers of troops to an area near the Islamic State-controlled Iraqi city of Mosul after Baghdad threatened to appeal to the United Nations to force Turkey to withdraw its soldiers.

Iraqi Prime Minister Haider al-Abadi addresses attendees during the 70th session of the United Nations General Assembly at the U.N. Headquarters in New York, September 30, 2015. REUTERS/Eduardo Munoz

Turkey deployed hundreds of forces to a camp in the Bashiqa region of northern Iraq on Thursday, calling it a routine rotation to train Iraqis to retake Mosul from Islamic State, which captured Iraq’s second-largest city in 2014.

Iraqi Prime Minister Haider al-Abadi said his country might turn to the U.N. security council if Turkish troops sent to northern Iraq were not withdrawn within 48 hours.

He said the deployment of hundreds of Turkish forces happened without the approval or knowledge of the Iraqi government and constituted a violation of national sovereignty.

Turkish Prime Minister Ahmet Davutoglu wrote a letter to Abadi, saying Turkey’s armed forces would not send additional forces until Baghdad’s “sensitivities” were placated. He stopped short of agreeing to Abadi’s demand to withdraw the soldiers.

“No further forces will be deployed to Bashiqa until concerns of the Iraqi government are overcome,” the letter said, according to sources at the prime minister’s office in Ankara.

“Turkey is ready to deepen its cooperation with Iraq in coordination and consultation. Those who are disturbed by the cooperation of Turkey and Iraq and who want to end it should not be allowed to attain their goal,” it said.

Davutoglu earlier said the activity was a routine troop rotation to support a camp that Turkish forces had previously set up at the Mosul governor’s request and in coordination with the Iraqi Defense Ministry.

Iraqi Defense Minister Khaled al-Obeidi said he told his Turkish counterpart the latest deployment had been made without informing or coordinating with Baghdad, and should be withdrawn.

He said the Turkish defense minister had explained the deployment as necessary to protect military advisers training Iraqi forces some 30 km (19 miles) northeast of Mosul in preparation for a campaign to retake the city. But Obeidi said the force was too large for such a purpose.

“No matter the size of the force entering Iraq, it is rejected,” the statement said. “It was possible to undertake this sort of prior coordination without creating circumstances which contributed to a crisis between the two countries.”

In his statement, Abadi said: “Iraq has the right to use all available options, including resorting to the U.N. security council if these forces are not withdrawn within 48 hours.”

A much-anticipated counter-offensive by Iraqi forces to retake Mosul from Islamic State has been repeatedly postponed because they are tied down in fighting elsewhere.

Iraq has urged the international community to provide more weapons and training in its battle against the militants, but rejects most forms of direct intervention, mistrusting the intentions of foreign powers.

A small number of Turkish trainers were already at the camp near Mosul before the latest deployment in order to train the Hashid Watani (national mobilization), a force made up of mainly Sunni Arab former Iraqi police and volunteers from Mosul.

The United States was aware of the deployment but the move is not part of the U.S.-led coalition’s activities, according to defense officials in Washington.

U.S. officials made several statements last week on plans to send more U.S. troops to Iraq, prompting Iraqi politicians and militias to protest against the presence of any foreign troops in Iraq without explicit permission from parliament.

Powerful Iraqi Shi’ite Muslim armed groups have pledged to fight a planned deployment of U.S. forces to the country.

NATO member Turkey has been bombing Kurdish militant positions in northern Iraq. It is also part of the U.S.-led coalition fighting Islamic State in Syria and Iraq.