An attempted attack by Islamic State on a military base in northern Iraq shows Turkey ' s decision to deploy troops there was justified, President Tayyip Erdogan said on Friday, suggesting Russia was stirring up a row over the issue. Turkey deployed a force protection unit of around 150 troops to northern Iraq in December citing heightened security risks near Bashiqa, where its soldiers have been training an Iraqi militia to fight Islamic State. Baghdad objected to the troop deployment, however. The head of the Sunni militia said his fighters and Turkish forces launched a joint "pre-emptive" attack on Islamic State around 10 km (6 miles) south of the base on Wednesday because the militants were building capacity to launch rockets at it. "Our forces managed to detect the position of these rockets so they conducted a preemptive strike," Atheel al-Nujaifi, former governor of the nearby Islamic State-controlled city of Mosul, told Reuters. "This operation was ended without a single rocket being launched at the camp," he said. Erdogan said no Turkish soldiers were harmed while 18 Islamic State militants were killed. "This incident shows what a correct step it was, the one regarding Bashiqa. It is clear that with our armed soldiers there, our officers giving the training are prepared for anything at any time," he told reporters in Istanbul. Iraqi Prime Minister Haider al-Abadi accused Ankara last week of failing to respect an agreement to withdraw its troop deployment, while majority-Shi'ite Iraq's foreign minister said Baghdad could resort to military action if forced. Erdogan said the problems over the deployment only started after Turkey's relations with Russia soured in the wake of Turkey shooting down a Russian fighter jet over Syria in November. "They (Iraq) asked us to train their soldiers and showed us this base as the venue. But as we see, afterwards, once there were problems between Russia and Turkey ... these negative developments began," Erdogan said. Turkey, he said, was acting in line with international law. The camp in Iraq's Nineveh province, to which Sunni Muslim power Turkey has historic ties, is situated around 140 km (90 miles) south of the Turkish border. Iraqi security forces have no presence in Nineveh after collapsing in June 2014 in the face of a lightning advance by Islamic State. Ankara has acknowledged there was a "miscommunication" with Baghdad over the troop deployment. It later withdrew some soldiers to another base in the nearby autonomous Kurdistan region and said it would continue to pull out of Nineveh. But Erdogan has ruled out a full withdrawal. Nujaifi said the international coalition bombing Islamic State targets in Iraq and Syria had supported ground forces with air strikes in Wednesday's operation. The coalition said it launched four strikes near Mosul on Wednesday, but a spokesman said they were not in direct support of the Turkish-Iraqi operation at Bashiqa.