* Baghdad regaining initiative against jihadist insurgents -army
* Iran says cooperation with US possible to ease Iraq crisis
* Iraqi PM visits front-line Samarra, vows to vanquish rebels
* Insurgents still press on some fronts, target oil refinery
By Ahmed Rasheed and Raheem Salman
BAGHDAD, June 14 (Reuters) - A Sunni Islamist offensive threatening to dismember Iraq seemed to slow on Saturday after days of lightning advances as government forces reported regaining territory in counter-attacks, easing pressure on Baghdad's Shi'ite-led government.
As Iraqi officials spoke of wresting back the initiative against Islamic State in Iraq and the Levant insurgents (ISIL), neighbouring Shi'ite Iran held out the prospect of working with its longtime U.S. arch-enemy to help restore security in Iraq.
In a visit to Samarra, a major town in ISIL's sights 100 km (60 miles) north of Baghdad, Prime Minister Nouri al-Maliki vowed to defeat the rebels who caused international shock waves when they overran the Sunni northwest of Iraq earlier this week.
The dramatic territorial surge by ISIL, putting demoralised and disorganised army contingents to flight, have alarmed both Maliki's Shi'ite supporters in Iran and in the United States, which helped bring him to power after its 2003 invasion that toppled Sunni dictator Saddam Hussein. Oil prices have jumped over fears of ISIL disrupting exports from OPEC member Iraq.
But the ISIL juggernaut appeared to lose momentum on Saturday with the Iraqi military saying it was now holding back the jihadist rebels and also, with the help of Shi'ite militia, clawing back some territory.
"Our security forces have regained the initiative to launch qualitative operations on various fronts over the past three days and have achieved remarkable victories with the help of volunteers," said Major-General Qassim al-Moussawi, spokesman for the Iraqi military's commander-in-chief.
"We have regained the initiative and will not stop at liberating Mosul from ISIL terrorists, but all other parts," he said, mentioning Iraq's second main city in the far north seized by the insurgents on Monday.
A spokesman for Iraqi counter-terrorism forces said warplanes bombed a meeting of the banned Baath party leadership in Diyala province, killing 50 people including the son of Ezzat Ibrahim al-Douri, once a member of Saddam's ruling circle.
ISIL had thrust into Diyala two days ago, opening a second front to Baghdad's northeast, not far from the Iranian border.
The ISIL advance has been joined by former Baathist officers who were loyal to Saddam as well as disaffected armed groups and tribes who want to oust Maliki. Douri is believed to lead a Baathist militant group called the Naqshbandi Army.
IRAQI ARMY COUNTER-ATTACKS
Security sources said Iraqi troops attacked an ISIL formation in the town of al-Mutasim, 22 km (14 miles) southeast of Samarra, driving militants out into the surrounding desert.
They said army forces reasserted control over the small town of Ishaqi, also southeast of Samarra, to secure a road that links Baghdad to Samarra and the now ISIL-held cities of Tikrit and Mosul further north.
Troops backed by the Shi'ite Asaib Ahl al-Haq militia also retook the town of Muqdadiya northeast of Baghdad, and ISIL was dislodged from Dhuluiya after three hours of fighting with tribesmen, local police and residents, a tribal leader said.
It was far from clear whether government forces could sustain their reported revival against ISIL, given serious weaknesses including poor morale and corruption, and the risk of Iraq sundering into hostile sectarian entities remains high.
ISIL insurgents kept up their assaults on some fronts.
In Udhaim, 90 km (60 miles) north of Baghdad, ISIL occupied the local municipal building, an official there told Reuters, and they directed mortar fire at the government protection force of the Baiji oil refinery, Iraq's largest.
Masked militants under the black flag of ISIL aim to revive a medieval caliphate that would span a fragmenting Iraq and Syria, redrawing borders set by European colonial powers a century ago and menacing neighbours like Iran and Turkey.
U.S. President Barack Obama said on Friday he was reviewing military options, short of sending combat troops, to help Iraq repel the insurgency. But he cautioned that any U.S. intervention must be accompanied by an Iraqi government effort to bridge divisions between Shi'ite and Sunni communi6ties.
Iranian President Rouhani, asked at a televised press conference whether Tehran could work with the United States to tackle ISIL, said: "We can think about it if we see America starts confronting the terrorist groups in Iraq or elsewhere.
"We all should practically and verbally confront terrorist groups," added Rouhani, a relative moderate who has presided over a thaw in Iran's long antagonistic relations with the West.
A senior Iranian official told Reuters earlier this week that Tehran, which has strong leverage in Shi'ite-majority Iraq, may be ready to cooperate with Washington against ISIL rebels.
The official said the idea of cooperating with the Americans was being mooted within the Tehran leadership. For now, according to Iranian media, Iran will send advisers and weaponry, although probably not troops, to boost Baghdad.
U.S. officials said there were no contacts going on with Iran over the crisis in Iraq.
Any initiative would follow a clear pattern of Iranian overtures since the 2001 al Qaeda attacks on U.S. targets, which led to quiet U.S.-Iranian collaboration in the overthrow of the Taliban in Afghanistan and formation of a successor government.
Adversaries since Iran's 1979 revolution toppled the U.S.-backed Shah, the United States and Iran have long accused each other of meddling in the Gulf and beyond, and have not cooperated on regional security issues for more than a decade.
MALIKI HERALDS FIGHTBACK
Maliki travelled on Friday to Samarra, one of the cities targeted - though not seized - by ISIL fighters who now prevail in a string of Sunni cities and towns running south from Mosul.
"Samarra will not be the last line of defence, but a gathering point and launchpad," he told military officers after Iraq's s most influential Shi'ite cleric urged people to take up arms to defend the country against the insurgents.
"Within the coming hours, all the volunteers will arrive to support the security forces in their war against the gangs of ISIL. This is the beginning of the end of them," Maliki, a Shi'ite Muslim, said in comments broadcast on Iraqi television.
Maliki said the cabinet had granted him unlimited powers to confront the ISIL offensive.
In Basra, Iraq's main city in the mainly Shi'ite far south, hundreds of people volunteered to join the battle against ISIL, heeding a call to arms by Grand Ayatollah Ali al-Sistani, who commands unswerving loyalty from most Iraqi Shi'ites.
The volunteers, of all ages, were due to be given weapons and sent to a security centre in Basra later on Saturday ready to be transferred further north. "We the people of Basra obeyed our instructions to defend our country from south to north," said 63-year-old Kadhem Jassim.
Iran's Rouhani said he would review any request for help submitted by Maliki, although none had been received yet. "We are ready to help in the framework of international regulations and laws," he said.
(Additional reporting by Isabel Coles in Arbil, Parisa Hafezi in Ankara and William Maclean in Dubai; Writing by Dominic Evans; Editing by Mark Heinrich)