Iraqi security forces have killed 279 "terrorists" in the past 24 hours, as they push back against a major Sunni insurgent offensive.

Prime Minister Nouri al-Maliki's security spokesman, Lieutenant General Qassem Atta, made the announcement during a televised news conference.

Iran warned that "any foreign military intervention in Iraq" would only complicate the crisis, after the US said it was deploying a warship in the Gulf.

"Iraq has the capacity and necessary preparations for the fight against terrorism and extremism," foreign ministry spokesman Marzieh Afkham was quoted as saying by the ISNA news agency.

"Any action that complicates the situation in Iraq is not in the interests of the country nor of the region," Afkham said.

"The people and government of Iraq will be able to neutralise this conspiracy."

Iraq is battling an offensive by Sunni militants, including the Islamic State of Iraq and Syria (ISIS), who have advanced to within 80km of Baghdad's city limits after seizing a swathe of the country's north.

ISIS is also known as the Islamic State in Iraq and Levant (ISIL) and the group's aim is to create an Islamic caliphate encompassing Iraq, Syria and Lebanon.

Responding to the crisis, the Pentagon said the US had ordered an aircraft carrier, the USS George HW Bush, into the Gulf.

Mr Afkham's comments come a day after President Hassan Rouhani said he believed the Iraqis have the capacity to "repel terrorism" and that Iran had not been asked for help by its neighbour.

But in surprise comments he added that Iran may consider cooperating with its arch-foe the US to fight the Sunni extremist militants in Iraq.

The deployment of the aircraft carrier was ordered by US Defence Secretary Chuck Hagel.

It comes amid calls for air strikes to blunt the insurgents' lightning offensive that caught Iraq's security forces on the hop, with many soldiers throwing away their uniforms and fleeing.

However, Iraqi troops launched a counter-offensive yesterday, recapturing two towns north of Baghdad.

Thousands of volunteers answered a call to arms from top Shia cleric Grand Ayatollah Ali al-Sistani.

The US is "committed" to supporting Iraq as it battles Sunni militants who have seized a swathe of the country's north, Secretary of State John Kerry told his Iraqi counterpart.