Fighting erupted at the northern approaches to Baghdad Tuesday as Iraq accused Saudi Arabia of backing militants who have seized swathes of territory in an offensive the UN says threatens its very existence.
Washington deployed some 275 military personnel to protect its embassy in Baghdad, the first time it has sent troops to Iraq since it withdrew its forces at the end of 2011 after a bloody and costly intervention launched in 2003.
It was also mulling air strikes against the militants, who are led by the jihadist Islamic State of Iraq and the Levant (ISIL) but also include loyalists of now-executed Sunni Arab dictator Saddam Hussein.
Since the insurgents launched their lightning assault on June 9, they have captured Mosul, a city of two million people, and a big chunk of mainly Sunni Arab territory stretching south towards the capital.
The offensive has displaced hundreds of thousands of people and sent jitters through world oil markets as the militants have advanced ever nearer Baghdad leaving the Shiite-led government in disarray.
Officials said on Tuesday that militants briefly held parts of the city of Baquba, just 60 kilometres (40 miles) from the capital.
They also took control of most of Tal Afar, a strategic Shiite-majority town between Mosul and the border with Syria, where ISIL also has fighters engaged in that country's three-year-old civil war.
The overnight attack on Baquba, which was pushed back by security forces but left 44 prisoners dead at a police station, marked the closest that fighting has come to the the capital.
Tal Afar gains
In Tal Afar, militants controlled most of the town but pockets of resistance remained.
Soldiers, police and armed residents held on to parts of its airport, the deputy head of the provincial council, Nureddin Qabalan, said.
Further south, security personnel abandoned the Iraqi side of a key crossing on the border with Syria, officers said.
Syrian rebel groups opposed to ISIL, who already controlled the other side of the Al-Qaim crossing, advanced across the border to take over.
The Iraqi army abandoned the Rabia border crossing further north to Kurdish forces last week..
In ethnically mixed Kirkuk province, militants took control of Multaqa village, but were repelled by security forces in Bashir village.
The swift advance of the militants has sparked international alarm, with UN envoy to Baghdad Nickolay Mladenov warning that Iraq's territorial integrity was at stake.
"Right now, it's life-threatening for Iraq but it poses a serious danger to the region," Mladenov told AFP.
"Iraq faces the biggest threat to its sovereignty and territorial integrity" in years.
The violence has stoked regional tensions, with Iraq accusing neighbouring Saudi Arabia on Tuesday of "siding with terrorism" and of being responsible for financing the militants.
The comments came a day after the Sunni kingdom blamed "sectarian" policies by Iraq's Shiite-led government for triggering the unrest.
The prime minister of Iraq's autonomous Kurdish region told the BBC it would be "almost impossible" for the country to return to how it was before the offensive, and called for Sunni Arabs to be granted an autonomous region of their own.
Alarmed by the collapse of much of the security forces in the face of the militant advance, foreign governments have begun pulling out diplomatic staff.
US President Barack Obama announced that around 275 military personnel "equipped for combat" were being deployed to Iraq to help protect the embassy in Baghdad and assist US nationals.
Washington has already deployed an aircraft carrier to the Gulf, but Obama has ruled out a return to combat in Iraq for US soldiers.
Watch: Militants post images of mass killing in Iraq
As the US weighed its next move, Secretary of State John Kerry said on Monday that drone strikes could be used.
Washington has ruled out cooperating militarily with Tehran, but the two governments -- which have been bitter foes for more than 30 years -- held "brief discussions" on the crisis in Vienna.
Drones have been used by the US against militants in Afghanistan, Pakistan and Yemen, but have been criticised by human rights groups for their heavy civilian toll.
Doubts are growing that the Iraqi security forces can hold back the militant tide, despite military commanders trumpeting a counter-offensive.
Soldiers and police fled en masse as the insurgents swept into Iraq's second city of Mosul a week ago, abandoning their vehicles and uniforms.
The jihadists are said to have killed scores of Iraqi soldiers as they pushed their advance, including in a "horrifying" massacre in Salaheddin province that has drawn international condemnation.
Top Shiite cleric Grand Ayatollah Ali al-Sistani has called for volunteers to join the battle against the militants and thousands have signed up.
More have returned home from neighbouring Syria, where they had been fighting alongside government forces against mainly Sunni rebels there, a monitoring group said.