Militants attacked one of Iraq's largest air bases on Wednesday as the first US teams arrived to assess the Iraqi security forces and decide how to help counter a mounting Sunni insurgency.
Two weeks of advances by militants spearheaded by al Qaeda offshoot the Islamic State in Iraq and the Levant (ISIS) has threatened to rupture the country two and a half years after the withdrawal of US troops.
US Secretary of State John Kerry urged leaders of Iraq's autonomous Kurdish region on Tuesday to stand with Baghdad in the face of the onslaught.
Militants including ISIS and allied Sunni tribes battled Iraqi forces in the town of Yathrib, 90 km north of Baghdad, into the early hours of Wednesday, witnesses and the deputy head of the municipality said. Four militants were killed, they said.
Insurgents have surrounded a massive air base nearby, which was known as "Camp Anaconda" under US occupation, and struck it with mortars. Eyewitnesses said the air base had been surrounded on three sides.
More than 1,000 people, mainly civilians, have been killed in less than three weeks, the United Nations has said, calling the figure "very much a minimum".
The figure includes unarmed government troops machine gunned in mass graves by insurgents, as well as several reported incidents of prisoners killed in their cells by retreating government forces.
US President Barack Obama has offered up to 300 American advisers to Iraq but held off granting a request by Prime Minister Nuri al-Maliki's government for air strikes.
Rear Admiral John Kirby, the Pentagon press secretary, said late on Tuesday 130 of the advisers had now been deployed, with the initial group sent to establish the operations centre included intelligence analysts, logistics experts and special operations forces.
Watch video: Kerry meets Kurdistan regional president
Kirby said about 40 special operations personnel already in the country and assigned to the US Embassy's Office of Security Cooperation had been deployed as part of the first two assessment teams.
About 90 additional troops arrived in Iraq to begin helping establish a Joint Operations Center in Baghdad with Iraqi forces. Another 50 US military personnel working in the region are expected to arrive within the next few days to create four additional assessment teams, Kirby said.
US military personnel also are flying regular manned and unmanned reconnaissance flights over Iraq - about 30 to 35 per day - to give better insight about the situation on the ground and help the assessment teams, he said.
Baghdad is racing against time as the insurgents consolidate their grip on Sunni provinces.
The Baiji refinery, a strategic industrial complex 200 km (120 miles) north of Baghdad, remained a frontline early on Wednesday. State TV showed troop reinforcements flying into the compound by helicopter to fend off the assault.
Local tribal leaders said they were negotiating with both the Shi'ite-led government and Sunni fighters to allow the tribes to run the plant if Iraqi forces withdraw. One government official said Baghdad wanted the tribes to break with ISIS and other Sunni armed factions, and help defend the compound.
The plant has been fought over since last Wednesday, with sudden reversals for both sides and no clear winner so far.
In recent days, Baghdad's grip on the Western frontier with Syria and Jordan has also been challenged.
One post on the Syrian border has fallen to Sunni militants and another has been taken over by the Kurds. A third crossing with Syria and the only crossing with Jordan are contested, with anti-government fighters and Baghdad both claiming control.
For ISIS, capturing the frontier is a step towards the goal of erasing the modern border altogether and building a caliphate across swathes of Iraq and Syria.
An Iraqi military spokesman said on Tuesday the government had carried out air strikes on a militant gathering in the town of al-Qaim near the Syrian border, which is under the control of the coalition of Sunni armed groups, including ISIS.
Washington has placed its hopes in forming a new, more inclusive government in Baghdad that would undermine the insurgency. Kerry aims to convince Kurdish leaders to join it.
In Baghdad on Monday Kerry said Maliki assured him the new parliament, elected two months ago, would sit by a July 1 deadline to start forming a new government. Maliki is fighting to stay in power, under criticism for the ISIS-led advance.
Read: A battle won? Advantage ISIS on the web in Iraq war
Full coverage: Iraq on the brink