ISTANBUL (Reuters) - Turkish President Tayyip Erdogan said on Saturday that Iraq could not deal alone with driving Islamic State from the city of Mosul and that the presence of Turkish forces in a nearby military camp was an insurance against attacks on Turkey.

Turkey has been locked in a row with Iraq's central government about the presence of Turkish troops at the Bashiqa camp in northern Iraq, and over who should take part in the planned U.S.-backed assault on Mosul.

"We won't let Mosul be given to Daesh (Islamic State) or any other terrorist organization. They say Iraq's central government needs to approve this but the Iraqi central government should first deal with their own problems," Erdogan said.

"Why did you let Daesh enter Iraq? Why did you let Daesh enter Mosul? They were almost going to come to Baghdad. Where are you, the central government of Iraq?" he said in a speech at a ceremony in the Black Sea town of Rize, broadcast live on TV.

Iraq's Prime Minister Haider al-Abadi reiterated on Saturday that the Turkish troops have deployed in Iraq without the authorization of the government.

"I won't allow the Turkish forces to take part in the operations to liberate Mosul in any possible way," he added in comments aired on Iraqi state TV.

Turkey fears that Shi'ite militias, which the Iraqi army has relied on in the past, will be used in the planned Mosul offensive, expected to start this month, stoking sectarian unrest and triggering an exodus of refugees.

Turkish soldiers have been training Sunni Muslim and allied Kurdish peshmerga units at the Bashiqa camp near Mosul, and want them to be involved in the assault.

"Nobody should talk about our Bashiqa base. We will stay there. Bashiqa is our insurance against any kind of terrorist activities in Turkey," Erdogan said.

The United States has said any foreign forces in Iraq should have the approval of Baghdad.

(Reporting by Nick Tattersall in Istanbul and Maher Chmaytelli in Baghdad; Editing by Andrew Bolton and Hugh Lawson)