* Kurds take control of oil city they regard as their historic capital

* Iraqi army flees in face of Sunni militant advance

* Hundreds of thousands flee worst fighting since U.S. withdrawal

* Global oil price surges, insurgents surround biggest refinery

By Ahmed Rasheed and Isabel Coles

BAGHDAD/ARBIL, June 12 (Reuters) - President Barack Obama on Thursday threatened U.S. military strikes in Iraq against Sunni Islamist militants who have surged out of the north to menace Baghdad and want to establish their own state in Iraq and Syria.

Iraqi Kurdish forces took advantage of the chaos to take control of the oil hub of Kirkuk as the troops of the Shi'ite-led government abandoned posts, alarming Baghdad's allies both in the West and in neighbouring Shi'ite regional power Iran.

"I don't rule out anything because we do have a stake in making sure that these jihadists are not getting a permanent foothold in either Iraq or Syria," Obama said at the White House when asked whether he was contemplating air strikes. Officials later stressed that ground troops would not be sent in.

Obama was looking at "all options" to help Iraq's leaders, who took full control when the U.S. occupation ended in 2011. "In our consultations with the Iraqis, there will be some short-term immediate things that need to be done militarily," he said.

A U.S. defense official said the United States had been flying surveillance drones over Iraq to help it fight the militant Islamic State of Iraq and the Levant (ISIL).

The Wall Street Journal, which reported the flights had been taking place in small numbers since last year, quoted a senior U.S. official as saying the intelligence was shared with Iraqi forces. The official added: "It's not like it did any good."

In his comments, Obama referred to long-standing U.S. complaints that Shi'ite Prime Minister Nuri al-Maliki had failed to do enough to heal a sectarian rift that has left many in the big Sunni minority, shut out of power when U.S. troops overthrew Saddam Hussein in 2003, nursing grievances and keen for revenge.

"This should be also a wakeup call for the Iraqi government. There has to be a political component to this," Obama said.

U.S. Vice President Joe Biden assured Maliki by telephone that Washington was prepared to intensify and accelerate its security support. The White House had signalled on Wednesday it was looking to strengthen Iraqi forces rather than meet what one U.S. official said were past Iraqi requests for air strikes.

As security concerns mounted, U.S. weapons maker Lockheed Martin Corp said on Thursday it was evacuating about two dozen employees from northern Iraq. The U.S. State Department said other companies were relocating workers as well.

"We can confirm that U.S. citizens, under contract to the Government of Iraq, in support of the U.S. Foreign Military Sales program in Iraq, are being temporarily relocated by their companies due to security concerns in the area," State Department spokeswoman Jen Psaki said in a statement.

She declined to say how many contractors were being relocated and their location, but said the U.S. Embassy and consulates were still operating normally.

With voters wary of renewing the military entanglements of the past decade, Obama stepped back last year from launching air strikes in Syria, where the ISIL is also active. But fears of violence spreading may increase pressure for international action. French Foreign Minister Laurent Fabius said international powers "must deal with the situation".

In Mosul, ISIL staged a parade of American Humvee patrol cars seized from a collapsing Iraqi army in the two days since its fighters drove out of the desert and overran the city.

At Baiji, near Kirkuk, insurgents surrounded Iraq's largest refinery, underscoring the potential threat to the oil industry. Residents near the Syrian border saw them bulldozing tracks through frontier sand berms - giving physical form to the dream of reviving a Muslim caliphate straddling both modern states.

AIR POWER

At Mosul, which had a population close to 2 million before recent events forced hundreds of thousands to flee, witnesses saw ISIL fly two helicopters over the parade, apparently the first time the militant group had obtained aircraft.

It was unclear who the pilots were but Sunnis who served in the forces of Saddam have rallied to the insurgency, led by an ambitious Iraqi former follower of al Qaeda's Osama bin Laden.

State television showed what it said was aerial footage of Iraqi aircraft firing missiles at insurgent targets in Mosul. The targets could be seen exploding in black clouds.

Further south, the fighters extended their lightning advance to towns only about an hour's drive from the capital, where Shi'ite militia are mobilising for a potential replay of the ethnic and sectarian bloodbath of 2006 and 2007.

The forces of Iraq's autonomous ethnic Kurdish north, known as the peshmerga, took over bases in Kirkuk vacated by the army. "The whole of Kirkuk has fallen into the hands of peshmerga," said peshmerga spokesman Jabbar Yawar.

"No Iraqi army remains in Kirkuk now."

Kurds have long dreamed of taking Kirkuk and its huge oil reserves. They regard the city, just outside their autonomous region, as their historic capital, and peshmerga units were already present in an uneasy balance with government forces..

The swift move by their highly organised security forces to seize full control demonstrates how this week's sudden advance by ISIL has redrawn Iraq's map - and potentially that of the entire Middle East, where national borders were set nearly a century ago as France and Britain carved up the Ottoman empire.

Since Tuesday, black-clad ISIL fighters have seized Mosul and Tikrit, Saddam's hometown, and other towns and cities north of Baghdad. The army has evaporated before the onslaught, abandoning bases and U.S.-provided weapons. Online videos purportedly showed a column of hundreds, possibly thousands, of troops without uniforms being marched under guard near Tikrit.

Security and police sources said Sunni militants now controlled parts of the town of Udhaim, 90 km (55 miles) north of Baghdad, after most of the army troops left their positions.

"We are waiting for reinforcements, and we are determined not to let them take control," said a police officer in Udhaim.

"We are afraid that terrorists are seeking to cut the main highway that links Baghdad to the north."

ISIL and its allies took control of Falluja at the start of the year. It lies just 50 km (30 miles) west of Maliki's office.

OIL PRICE SURGE

The top U.N. official in Iraq assured the Security Council the capital was in "no immediate danger". The council offered unanimous support to the government and condemned "terrorism".

As with the back-to-back war in Syria, the conflict cuts across global alliances. The United States and Western and Gulf Arab allies back the mainly Sunni revolt against Iranian-backed Syrian President Bashar al-Assad, but have had to watch as ISIL and other Islamists have come to dominate large parts of Syria.

Now the Shi'ite Islamic Republic of Iran, which in the 1980s fought Saddam for eight years at a time when the Sunni Iraqi leader enjoyed quiet U.S. support, may share an interest with the "Great Satan" Washington in bolstering mutual ally Maliki.

The global oil benchmark jumped more than 2 percent on Thursday, as concerns mounted that the violence could disrupt supplies from the OPEC exporter. Iraq's main oil export facilities are in the largely Shi'ite areas in the south and were "very, very safe", oil minister Abdul Kareem Luaibi said.

ISIL fighters have overrun the town of Baiji, site of the main oil refinery that meets Iraq's domestic demand for fuel. Luaibi said the refinery itself was still in government hands. However, late on Thursday, police and an engineer inside the plant said insurgents were surrounding it.

Militants have set up military councils to run the towns they captured, residents said. "They came in hundreds to my town and said they are not here for blood or revenge but they seek reforms and to impose justice. They picked a retired general to run the town," said a tribal figure from the town of Alam.

"'Our final destination will be Baghdad, the decisive battle will be there' - that's what their leader kept repeating."

Security was stepped up in Baghdad to prevent the Sunni militants from reaching the capital, which is itself divided into Sunni and Shi'ite neighbourhoods and saw ferocious sectarian street fighting in 2006-2007 under U.S. occupation.

By midday on Thursday, insurgents had not entered Samarra, the next big city in their path on the Tigris north of Baghdad.

"The situation inside Samarra is very calm today, and I can't see any presence of the militants. Life is normal here," said Wisam Jamal, a government employee in the mainly Sunni city, which is also home to a major Shi'ite pilgrimage site.

LOW MORALE

The million-strong Iraqi army, trained by the United States at a cost of nearly $25 billion, is hobbled by low morale and corruption. Its effectiveness is hurt by the perception in Sunni areas that it pursues the hostile interests of Shi'ites.

The Obama administration had tried to keep a contingent of troops in Iraq beyond 2011 to prevent a return of insurgents, but failed to reach a deal with Maliki. A State Department official said on Thursday Washington was disappointed after "a clear structural breakdown" of the Iraqi forces.

Iraq's parliament was meant to hold an extraordinary session on Thursday to vote on declaring a state of emergency but failed to reach a quorum, a sign of the sectarian political dysfunction that has paralysed decision-making in Baghdad.

The Kurdish capture of Kirkuk overturns a fragile balance of power that has held Iraq together since Saddam's fall.

Iraq's Kurds have done well since 2003, running their own affairs while being given a fixed percentage of the country's overall oil revenue. But with full control of Kirkuk - and the vast oil deposits beneath it - they could earn more on their own, eliminating the incentive to remain part of a failing Iraq.

With Syria's Kurds already exploiting civil war there to run their own affairs, Iraqi Kurdish expansionism could worry U.S. ally Turkey, which has its own large Kurdish minority and fears a renewed attempt to redraw borders and create a Kurdish state.

Maliki's army already lost control of much of the Euphrates valley west of the capital to ISIL last year, and with the evaporation of the army in the Tigris valley to the north, the government could be left with just Baghdad and areas south - home to the Shi'ite majority in Iraq's 32 million population.

Iran, which funds and arms Shi'ite groups in Iraq, could be brought deeper into the conflict, as could Turkey to the north. In Mosul, 80 Turks were held hostage by ISIL after Ankara's consulate there was overrun.

Maliki described the fall of Mosul as a "conspiracy" and said the security forces who had abandoned their posts would be punished. In a statement on its Twitter account, ISIL said it had taken Mosul as part of a plan "to conquer the entire state and cleanse it from the apostates" - meaning Shi'ites.

Militants were reported to have executed soldiers and policemen after their seizure of some towns.

ISIL, led by Abu Bakr al-Baghdadi, broke with al Qaeda's international leader, Osama bin Laden's former lieutenant, Ayman al-Zawahri, and has clashed with al Qaeda fighters in Syria, often employing brutal methods against enemies.

In Syria, it controls swaths of territory, funding its advances through extorting local businesses, seizing aid and selling oil. In Iraq, it has carried out regular bombings against Shi'ite civilians, killing hundreds a month. (Additional reporting by Ghazwan Hassan in Tikrit, Ziad al-Sinjary in Mosul, Mustafa Mahmoud in Kirkuk, Raheem Salman and Isra al-Rubei'i in Baghdad and Jeff Mason, Steve Holland, Roberta Rampton, Lesley Wroughton, Missy Ryan and Andrea Shalal in Washington; Writing by Peter Graff and Alastair Macdonald; Editing by Philippa Fletcher, Will Waterman, Peter Cooney and Paul Tait)