Istanbul (AFP) - Turkey will not withdraw troops it has deployed near an area controlled by the Islamic State group, a senior Turkish official said, after Iraq ordered the immediate withdrawal of its latest contingent.

Turkey deployed up to 300 soldiers to the Bashiqa area near the city of Mosul, the jihadist group's main hub in Iraq, describing it as a routine rotation in its programme of training Iraqis to retake the city from IS.

But Baghdad on Sunday gave Turkey 48 hours to withdraw its forces, saying they had entered the country illegally and threatening to appeal to the UN Security Council.

"We expect them to remain," the official told a group of foreign media representatives in Istanbul.

"It will depend on discussions but obviously our forces, as we know from the officers on the ground, from the demands of different groups over there, from what we are discussing with the central government and from what we have discussed with the KRG (Kurdistan Regional Government (KRG), they will stay," he said.

The official said the new deployment last week included 150 to 300 soldiers backed by 20 tanks near a base in Basiqa, some 30 kilometres (18 miles) north of Mosul, which was seized by IS in June 2014.

Turkey first deployed troops at the base almost two years ago in coordination with the Iraqi defence ministry to train both Iraqi Kurdish Peshmerga forces and Sunni Arabs hoping to retake Mosul from IS, the official added.

Turkish Prime Minister Ahmet Davutoglu on Sunday said in a letter to his Iraqi counterpart Haider al-Abadi that there would be no new deployment of forces until Baghdad's concerns were addressed, but the future of the forces already sent had remained unclear.

In an interview with Turkey's Kanal 24 television on Monday, Turkish Foreign Minister Mevlut Cavusoglu said: "It is our duty to provide security for our soldiers providing training" around Mosul.