ARBIL, Iraq — U.S. Secretary of State John Kerry urged leaders of Iraq's autonomous Kurdish region on Tuesday to stand with Baghdad in the face of a Sunni insurgent onslaught that threatens to dismember the country.

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 (60 miles) 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 machine-gunned 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 on a trip through the Middle East to rescue Iraq following a lightning advance by the Sunni fighters led by jihadis of 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.

Kerry told Barzani that Iraq needed to stay united, a State Department official said, referring to the Kurdish leader's comments about wanting an independent state.

The official summarized Kerry's message as: "Whatever your aspirations are for your future, your interests now in the near-term are for a stable, sovereign and unified Iraq."

The 5 million Kurds, who have ruled themselves within Iraq in relative peace since the 1990s, 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 a 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 meet 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 Sunni militants are "well positioned" to hold a broad swathe of captured territory if Baghdad fails to produce a robust counteroffensive, said a senior U.S. intelligence official, who spoke on condition of anonymity.

ISIL has bolstered its ability to take and hold territory by striking alliances with local Sunni religious leaders and tribes, and by conscripting local men into its ranks, the U.S. official said.

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.

Four people were killed and 12 wounded when four army helicopters bombed the city of Baiji Tuesday evening, according to local tribal sheiks, medics and eyewitnesses.

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 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 northeastern Iraq, violence continued between Sunni militants and Kurdish peshmerga fighters. Police in Diyala province said two peshmerga members were killed by a sniper and two wounded in Jalawla, 115 km (70 miles) northeast of Baghdad.

Police in Kirkuk said gunmen shot dead a local ethnic Turkmen government official in his car in the city centre.

In the town of Yathrib, 90 km (56 miles) 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 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 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 ISIL.

A hospital official in Qaim said 17 people died in the strikes and 52 were wounded, numbers that were impossible to confirm independently.

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 (620 miles) 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. Secretary of State John Kerry urged leaders of Iraq's autonomous Kurdish region on Tuesday to stand with Baghdad in the face of a Sunni insurgent onslaught that threatens to dismember the country.