* Government troops battle fighters for control of refinery
* U.S. sees Kurds as key to keeping Iraq from disintegrating
* Kurds have taken advantage of chaos to seize Kirkuk, oil fields
Security forces fought Sunni armed factions for control of the country's biggest oil refinery on Tuesday and militants launched an attack on one of its largest air bases less than 100 km from the capital.
More than 1,000 people, mainly civilians, have been killed in less than three weeks, the United Nations said on Tuesday, calling the figure "very much a minimum".
The figure includes unarmed government troops machinegunned in mass graves by insurgents, as well as several reported incidents of prisoners killed in their cells by retreating government forces.
Kerry flew to the Kurdish region after a day in Baghdad on an emergency trip through the Middle East to rescue Iraq after a lightning advance by Sunni fighters led by an al Qaeda offshoot, the Islamic State in Iraq and the Levant.
U.S. officials believe that persuading the Kurds to stick with the political process in Baghdad is vital to keep Iraq from splitting apart.
"If they decide to withdraw from the Baghdad political process it will accelerate a lot of the negative trends," said a senior State Department official who briefed reporters on condition of anonymity.
Kurdish leaders have made clear that the settlement keeping Iraq together as a state is now in jeopardy.
"We are facing a new reality and a new Iraq," Kurdish President Massoud Barzani said at the start of his meeting with Kerry. Earlier, he blamed Prime Minister Nuri al-Maliki's "wrong policies" for the violence and called for him to quit, saying it was "very difficult" to imagine Iraq staying together.
The 5 million Kurds, who have ruled themselves within Iraq in relative peace since the U.S. invasion that toppled Saddam Hussein in 2003, have seized on this month's chaos to expand their own territory, taking control of rich oil deposits.
Two days after the Sunni fighters launched their uprising by seizing the north's biggest city Mosul, Kurdish troops took full control of Kirkuk, a city they consider their historic capital and which was abandoned by the fleeing Iraqi army.
The Kurds' capture of Kirkuk, just outside the boundary of their autonomous zone, eliminates their main incentive to remain part of Iraq: its oil deposits could generate more revenue than the Kurds now receive from Baghdad as part of the settlement that has kept them from declaring independence.
Some senior Kurdish officials suggest in private they are no longer committed to Iraq and are biding their time for an opportunity to seek independence. In an interview with CNN, Barzani repeated a threat to hold a referendum on independence, saying it was time for Kurds to decide their own fate.
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 ISIL-led advance.
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 Tuesday. Militants said late on Monday they had seized it, but two government officials said troop reinforcements had been flown into the compound and fended off the assault.
Local tribal leaders said they were negotiating with both the government and Sunni fighters to allow the tribes to run the plant if Iraqi forces withdraw. One of the government officials said Baghdad wanted the tribes to break with ISIL 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 the town of Yathrib, 90 km north of Baghdad, tribes aided by ISIL fighters attacked the huge al Bakr air base, known under U.S. occupation as "Camp Anaconda", with mortars, according to a security source and the deputy head of the municipality.
Police and army forces also clashed with ISIL militants just north of the town of Udhaim in nearby Diyala province, after being driven out of the town into several villages around the Himreen mountains, a militant hideout, security sources said.
In recent days, Baghdad's grip on the Western frontier with Syria and Jordan has 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 ISIL, capturing the frontier is a dramatic step towards the goal of erasing the modern border altogether and building a caliphate across swathes of Iraq and Syria.
Kerry thanked the Kurds for their "security cooperation" in recent days, and said their forces were "really critical in helping to draw a line with respect to ISIL."
Kurdistan now shares a border more than 1,000 km long with territory held by insurgents. Militants have skirmished with Kurdish peshmerga forces, but both sides have sought to avoid an all-out confrontation for now.
U.S. President Barack Obama has offered up to 300 American advisers to Iraq but held off granting a request by Maliki's Shi'ite Muslim-led government for air strikes.
The insurgency has been fuelled by a sense of persecution among many of Iraq's Sunnis, including armed tribes who once fought al Qaeda but are now battling alongside the ISIL-led revolt against Maliki's Shi'ite-led government.
Maliki's State of Law coalition won the most seats in the election in April but still needs support from rival Shi'ite factions as well as Kurds and Sunnis to keep him in power.
Some State of Law figures have suggested they could replace Maliki to build a government around a less polarising figure, although Maliki's allies say he has no plan to step aside.
His main foreign sponsors, Washington and Tehran, have both called for a swift agreement on an inclusive government, suggesting they may be ready to abandon the combative 64-year-old Shi'ite Islamist after eight years in power.
Maliki has put himself at odds with the Kurds, who accuse him of reneging on promises made in exchange for their backing to stay in power after the last election in 2010. Relations are now characterised by deep mistrust, but the State Department official said Washington hopes the Kurds can be wooed back.
"If we are to have a chance ... to use this process of forming a new government to reset the political foundation here, the Kurds have to be a critical part of that process, and we think they will be," the senior State Department official said.
The Kurds have signed oil deals on their own terms with Turkey and late last year completed an independent export pipeline, despite opposition from both Baghdad and Washington. A tanker delivered a cargo of oil from the new pipeline for the first time on Friday, to Israel.