US president Donald Trump has said his country will not take any side in Iraq, where government troops took control of the oil-rich city of Kirkuk after advancing in Kurdish-controlled territories.

Iraqi soldiers captured the Kurdish government headquarters buildings and seized several districts and oil fields, prompting thousands of Kurdish civilians to flee Kirkuk, on Monday 16 October. The advance took place in the wake of an independence referendum held in Iraq's autonomous Kurdistan region.

"We've had for many years a very good relationship with the Kurds as you know and we've also been on the side of Iraq, even though we should have never been there in the first place," Trump told reporters at the the White House, according to Reuters.

He said Washington would not take sides, but added that "we don't like the fact that they're clashing."

Senator John McCain, chairman of the Senate Armed Services Committee, warned Iraq's government of "severe consequences" over misuse of US-provided weaponry against Kurdish forces.

Baghdad said Kurdish Peshmerga soldiers - the official army of Kurdistan - had withdrawn "without fighting", but some reports say there were clashes in the town.

The Peshmerga General Command said in a statement that the attack on Kirkuk was "a flagrant declaration of war against the nation of Kurdistan," Kurdish news agency Rudaw said.

The command also warned that the government of Iraq should pay a "heavy price" for initiating the conflict.

Iraqi prime minister Haider al-Abadi, who previously dismissed claims of Iraqi troops advancing in Kurkuk as "fake news", now said that the invasion was necessary to ensure the integrity of the state.

"We have only acted to fulfill our constitutional duty to extend the federal authority and impose security and protect the national wealth in this city, which we want to remain a city of peaceful coexistence for all Iraqis," he said in a statement on its Facebook page.

Tensions in the region

Iraq army soldiers Kirkik
Iraqi forces gather in the area of Taza Khurmata on the southern outskirts of Kirkuk on 15 October 2017. The presidents of Iraq and Iraqi Kurdistan held talks to defuse an escalating crisis, after a deadline for Kurdish forces to withdraw from disputed positions was extended by 24 hours. AHMAD AL-RUBAYE/AFP/Getty Images

Iraqi Kurds headed to the polls in September to decide whether they wanted their autonomous region to be independent from the rest of the country. In spite of an overwhelming "yes" vote, the referendum is not legally binding and Kurdish authorities intend to use it to pressurise Baghdad into starting negotiations and formalise independence.

Kirkuk is not part of the Kurdistan region, but its people took part in the referendum and overwhelmingly backed independence.

Peshmerga fighters had advanced into Kirkuk to counter the Islamic State (Isis) terror group, which seized several areas of the country. But now Isis is progressively losing territories in the country, the Kurds' fight to gain independence has regained new momentum.

Iraq deemed the referendum as unconstitutional and warned there would be consequences. It imposed an "air embargo" on Erbil, the Kurdish regional capital, and Sulaimaniyah, its second city.

The referendum was also opposed by Turkey and Iran, which urged Kurdish officials to call it off. They fear that the vote could spark independence sentiments among Kurdish populations in their own countries.

The US is also concerned that Iran might have been involved in the taking over of Kirkuk as Iraqi troops advanced along with the Iranian-backed Popular Mobilisation Units (PMU), an umbrella organisation representing several groups, most of which are Shia Muslim.

"I am especially concerned by media reports that Iranian and Iranian-backed forces are part of the assault. Iraqi forces must take immediate steps to de-escalate this volatile situation by ceasing their advances," McCain said in a statement.