Turkish Prime Minister Binali Yildirim says Turkey is ready to "take measures" in northern Iraq because Ankara is not satisfied with promises from the United States and Baghdad about the role of Kurdish militants and Shi'ite militia fighters in the battle for Mosul.

Yildirim made the remarks late on October 22 after Iraq's Prime Minister Haidar al-Abadi rejected a call by U.S. Defense Secretary Ash Carter's for Baghdad to give Turkish forces a role in recapturing the northern Iraqi city from Islamic State (IS) militants.

Abadi said after meeting with Carter in Baghdad on October 22 that he knew Turkey wants to participate in the battle for Mosul.

"We tell them thank you, this is something the Iraqis will handle and the Iraqis will liberate Mosul and the rest of the territories," Abadi said.

Yildirim expressed concern about the way Shi'ite militia and fighters from Turkey’s outlawed Kurdistan Workers Party (PKK) might treat Sunni Arab residents of Mosul after the city is recaptured from IS militants.

Yildirim said Turkey's military has "made every preparation to take our measures because the promises given by the United States and Iraq about the PKK and Shi'ite militias not being part of operations has not satisfied us yet."

He added, "Turkey can never remain idle against massacres, potential refugee waves, and clashes along its border, and it will take action if necessary."

The U.S. defense secretary's talks with Abadi on October 22 came a day after Carter said he'd reached "an agreement in principle" with Ankara about a role for Turkey's military in the battle for Mosul.

Carter stressed that any final decision would be up to Baghdad, but also expressed hope that the Turks and Iraqis would be able to resolve their differences.

On October 22, Carter admitted to reporters that the issue of a Turkish role in the Mosul campaign was a difficult subject.

He said the United States had a role "to work with our partners in the coalition and the Iraqi government to try to resolve issues like this and make sure that we're all focused" on fighting against IS militants.

Turkey, a regional power with the second largest armed force in NATO, has at least 500 and as many as 1,000 soldiers stationed at a military camp near the town of Bashiqa in northern Iraq -- about 24 kilometers to the northeast of Mosul.

Posted there at the invitation of Iraq's northern Kurdish autonomous region, the Turkish forces have been training Sunni Muslim tribal fighters and Iraqi Kurdish Peshmerga at a military base known as Camp Bashiqa since late 2015 outside of the IS-controlled town of Bashiqa.

But the Turkish military presence has sparked a dispute with Iraq's Shi'ite-led government in Baghdad, which wants its forces to be at the forefront of the offensive and has repeatedly called for the Turkish troops to leave the country.

Washington has been urging Ankara and Baghdad to resolve the dispute.

It has said that any foreign forces in Iraq should be there with the approval of Iraq's government in Baghdad and should also fall under the umbrella of the U.S.-led coalition against IS.

While Turkey has been supporting Iraq's Kurdish Peshmerga fighters within the U.S.-led coalition, Ankara also been carrying out air strikes in northern Syria against U.S.-backed Syrian Kurds that also are part of the coalition -- the Syrian Kurdish Democratic Union Party (PYD) and its People's Protection Units (YPG).

Turkish President Recep Tayyip Erdogan has vowed that he will not allow the PYD and YPG to create a Kurdish stronghold in northern Syria along Turkey's southern border, saying that it would bolster fighters from the outlawed PKK -- which both Ankara and Washington consider to be a terrorist group.

Erdogan alleges that there are links between the outlawed PKK in Turkey and the U.S.-backed PYD in northern Syria.