Two rockets have struck a training base south of Baghdad where US-led coalition troops and NATO trainers are present, Iraq's military has said.

The attack, the third targeting military bases hosting foreign forces in a week, targeted the Besmaya base south of Baghdad on Monday night, read the statement, making no mention of casualties.

More:

Spanish forces linked to the US-led coalition fighting the Islamic State of Iraq and the Levant (ISIL or ISIS), as well as NATO training forces, are present in Besmaya.

Earlier on Monday, US Secretary of State Mike Pompeo warned Iraq that the US would retaliate "as necessary" against any new assaults on Americans.

Since late October, there have been 24 rocket attacks on the US embassy in Baghdad or bases where foreign troops are deployed, killing three American military personnel, one British soldier and one Iraqi soldier.

No attacks have been claimed but Washington has blamed Kataeb Hezbollah, a hardline faction in the Hashd al-Shaabi (Popular Mobilisation Forces) state-sponsored military network.

Iraq has long feared it would get caught in the spiralling tensions between Iran and the US, its two main allies.

Tensions between the two countries dramatically spiked in late 2019 when a US contractor was killed in a rocket attack on a separate base in northern Iraq, leading to retaliatory American strikes on Kataeb Hezbollah.

Days later, a US drone strike killed Iranian commander Qasem Soleimani and Hashed deputy chief Abu Mahdi al-Muhandis.

Iran launched ballistic missiles at US troops in Iraq while the Iraqi parliament voted to expel all foreign soldiers from its soil, a decision that has yet to be implemented.

Some 5,200 American troops are based in Iraq as part of the US-led coalition.

Top US military and civilian officials had long expressed frustration that Iraq's government was not doing enough to prevent rocket attacks targeting US troops and diplomats.