Pro-government forces battled Sunni militants at a key town and Iraq's biggest oil refinery as John Kerry pushed the country's leaders Tuesday to heal rifts in a crisis threatening to tear it apart.
Security forces successes, including retaking a border crossing with Syria, were marred by air strikes that killed civilians during a counter-offensive against insurgents led by the Islamic State of Iraq and the Levant (ISIL) who have seized swathes of five provinces north and west of Baghdad.
The US Secretary of State's unannounced trip to Arbil in Iraq's autonomous Kurdish region came a day after he pledged "intense" American support to Iraq to repel the insurgent advance.
The militant onslaught has displaced hundreds of thousands of people, alarmed world leaders, and put Prime Minister Nuri al-Maliki under pressure at home and abroad.
After wilting in the face of the initial militant attack two weeks ago, Iraqi forces appear to be performing better, holding off major assaults at the Baiji oil refinery and the western town of Haditha.
The overnight attack on the refinery complex -- the scene of heavy fighting in recent days -- was repulsed by security forces, officials said.
Previous assaults on Baiji, which previously filled some 50 percent of Iraq's demand for refined petroleum products, sent jitters through world oil markets.
Elsewhere, security forces and allied tribal fighters saw off a militant attack on Haditha in Anbar province, after Iraqi forces recaptured a border crossing with Syria on Monday.
They also carried out air strikes on Baiji town and the western border area of Husseibah.
State television said 19 "terrorists" were killed in Baiji, but officials and witnesses said the casualties were civilians, and of 13 people killed in Husseibah, seven were insurgents.
Iraqi forces have struggled to hold their ground against the insurgent advance, with Maliki's security spokesman saying "hundreds" of soldiers have been killed since the offensive began late on June 9 -- the most specific official information so far on government losses.
A UN spokesman in Geneva told reporters Tuesday that at least 1,075 people were killed and 658 wounded in Iraq between June 5 and 22.
Militants were able to overrun the strategic Shiite-majority northern town of Tal Afar and its airport after days of heavy fighting, and at the weekend, insurgents swept into Rawa and Ana towns in Anbar province west of Baghdad after taking the Al-Qaim border crossing with Syria.
Kerry was in the Kurdish regional capital to urge president Massud Barzani to work to uphold Iraqi cohesion, telling him that "this is a very critical time for Iraq and the government formation challenge is the central challenge that we face".
Kurdish forces were "really critical in helping to draw a line with respect to ISIL", he added.
Barzani told Kerry that Kurds seek "a solution for the crisis that we have witnessed", but warned that it had created a "new reality and a new Iraq".
The militant offensive has cleared the way for Iraqi Kurds to take control of disputed territory they want to incorporate into their autonomous region over Baghdad's strong objections.
Speaking to CNN before Tuesday's talks, Barzani called for Maliki, whom he blamed "for what has happened" in Iraq, to step down.
Pressed on whether Iraqi Kurds would seek independence, Barzani said: "The time is here for the Kurdistan people to determine their future and the decision of the people is what we are going to uphold."
In Baghdad on Monday, Kerry met Maliki and other leaders to urge the speedy formation of a government following April elections in order to face down the insurgents.
Washington's "support will be intense, sustained, and if Iraq's leaders take the necessary steps to bring the country together, it will be effective," Kerry said.
"This is a critical moment for Iraq's future."
Maliki told Kerry the crisis "represents a threat not only to Iraq but to regional and international peace".
US leaders have stopped short of calling for Maliki to go, but there is little doubt they feel he has squandered the opportunity to rebuild Iraq since American troops withdrew in 2011.
President Barack Obama has offered to send up to 300 military advisers to Iraq, but has so far not backed air strikes as requested by Baghdad.
ISIL aims to create an Islamic state incorporating both Iraq and Syria, where it has become a major force in the rebellion against President Bashar al-Assad.
It has commandeered an enormous quantity of cash and resources because of the advance, bolstering coffers that were already the envy of militant groups worldwide.
In Brussels, a two-day meeting of foreign ministers from NATO countries begins Tuesday to discuss the situation in Iraq, as well as Ukraine.