BAGHDAD (Reuters) - Iraqi forces announced on Thursday they had captured Islamic State’s last stronghold in northern Iraq, leaving the militant group holed up near the Syrian border as its self-proclaimed “caliphate” shrinks further.

The town of Hawija and the surrounding areas fell in an offensive by U.S.-backed Iraqi government troops and Iranian-trained and armed Shi’ite paramilitary groups known as Popular Mobilisation.

Some fighting took place to the north and east of the town where the militants were surrounded.

With the fall of Hawija, which lies near the Kurdish-held oil city of Kirkuk, the only area that remains under control of Islamic State in Iraq is a stretch alongside the western border with Syria, where the militant group is also in retreat.

The capture of Hawija was a boost for the Iraqi government, which faces a separate crisis in the north of the country, where the Kurdish minority last month voted overwhelmingly in support of independence for their autonomous region.

In Hawija, state TV showed footage of Iraqi forces raising flags in one of the town's squares while Humvees patrolled empty streets littered with car wrecks, houses riddled with bullets and shattered storefronts. (Graphics on 'Iraqi Kurds' independence push' - )

“The army’s 9th armored division, the Federal Police, the Emergency Response division and ... Popular Mobilisation liberated Hawija,” said a statement from the joint operations commander, Lieutenant-General Abdul Ameer Rasheed Yarallah.

Thick black smoke rose from areas surrounding Hawija, from oil wells set on fire by the militants to prevent air detection.

Slideshow ( 6 images )

The capture of Hawija brings Iraqi forces into direct contact with Kurdish Peshmerga fighters who control Kirkuk, a multi-ethnic region claimed by both Baghdad and the Kurdistan Regional Government (KRG).

Kirkuk shaped up as a flashpoint last month when the KRG included the city in the referendum on Kurdish independence in northern Iraq.

“We don’t want any aggression or confrontations but the federal authority must be imposed in the disputed areas,” Iraqi Prime Minister Haider al-Abadi told a news conference in Paris with French President Emmanuel Macron.

Macron offered to mediate between the Iraqi government and Kurdish regional authorities, and promised to maintain a military presence there until Islamic State was defeated.

IRAQI SANCTIONS

The Iraqi government has imposed sanctions in response to the independence vote, but Abadi said he could understand the Kurds’ “aspirations”, provided they were expressed in accordance with the constitution.

The outcome of the referendum has raised concerns in Iraq and abroad that a conflict might break out there along ethnic lines, potentially weakening the campaign against Islamic State.

Turkey, which is battling a three-decade-old insurgency by its own Kurdish militants, has led regional opposition to the Iraqi Kurds’ independence hopes.

Slideshow ( 6 images )

Stepping up his rhetoric on the issue, President Tayyip Erdogan said Turkey would soon close its border with northern Iraq and shut its air space in response to the referendum.

He added that Turkey, Iran and Iraq would jointly decide on closing the flow of oil from northern Iraq, a vital source of earnings for Iraqi Kurdistan.

On Wednesday, Russian President Vladimir Putin, whose country has big energy interests in Kurdistan, said it was in no one’s interest to cut off oil supplies from the territory.

But Erdogan said that “if a decision will be made on closing oil taps in the region, that will be made by us. Turkey, Iran and Iraq’s central government will do so together”.

Erdogan’s stance has been backed by Iran. After meeting Erdogan in Tehran on Wednesday, Supreme Leader Ayatollah Ali Khamenei said Iran and Turkey should prevent the Iraqi Kurds from declaring independence.

Relations have been cool between Shi’ite Iran and mainly Sunni Turkey. But both have been alarmed by the independence vote, fearing it will encourage separatism among their own Kurdish populations.

The Kurds are the region’s fourth-largest ethnic group, spread across Iran, Turkey, Syria and Iraq, all of which oppose any moves towards a Kurdish state.

IRAQI OFFENSIVE

Iraq launched an offensive on Sept. 21 to dislodge Islamic State from the Hawija area, where up to 78,000 people were estimated to be trapped, according to the United Nations.

The militants control the border town of al-Qaim and the region surrounding it.

They also hold parts of the Syrian side of the border, but the area under their control is shrinking as they retreat in the face of two different sets of hostile forces - a U.S.-backed, Kurdish-led coalition and Syrian government troops with foreign Shi’ite militias backed by Iran and Russia.

Islamic State’s cross-border “caliphate” effectively collapsed in July, when U.S.-backed Iraqi forces captured Mosul, the group’s de facto capital in Iraq, in a grueling battle which lasted nine months.

The militants’ leader, Abu Bakr al-Baghdadi, who declared the caliphate from Mosul in mid-2014, released an audio recording last week that indicated he was alive, after several reports he had been killed.

He urged his followers to keep up the fight despite setbacks.