By Ghazwan Hassan
BAGHDAD, June 18 (Reuters) - Iran's president vowed on Wednesday to defend Shi'ite holy sites in Iraq, where Sunni militants battled their way into the biggest oil refinery in what is rapidly turning into a sectarian war across the frontiers of the Middle East.
Sunni fighters were in control of three quarters of the territory of the Baiji refinery north of Baghdad, an official said there, after a morning of heavy fighting at gates defended by elite troops under siege for a week.
A lightning advance has seen Sunni fighters rout the Shi'ite-led government's army and seize the main cities across the north of the country since last week.
The fighters are led by the Islamic State of Iraq and the Levant which aims to build a caliphate ruled on medieval precepts, but also include a broad spectrum of more moderate Sunnis furious at what they see as oppression by Baghdad.
Washington and other Western capitals are trying to save Iraq as a united country by leaning hard on Shi'ite Prime Minister to reach out to Sunnis. Maliki met Sunni and Kurdish political opponents overnight, concluding with a frosty, carefully-staged joint appearance at which an appeal for national unity was read out.
But so far Maliki's government has relied almost entirely on his fellow Shi'ites for support, with officials lashing out at Sunni political leaders as traitors. Extra-legal Shi'ite militia - many believed to be funded and backed by Iran - have mobilized to halt the Sunni advance, as Baghdad's million-strong army, built by the United States at a cost of $25 billion, crumbles.
Overt participation by Iran, the Middle East's main Shi'ite power which fought a war that killed a million people against Iraq in the 1980s, would transform the fight into a conflict spanning the frontiers of the region.
Speaking on live television to a crowd, Iran's President Hassan Rouhani made the clearest declaration yet that Tehran was prepared to mobilize.
"Regarding the holy Shia shines in Karbala, Najaf, Kadhimiya and Samarra, we announce to the killers and terrorists that the big Iranian nation will not hesitate to protect holy shrines," he said.
He said many people had signed up to go to Iraq to fight, although he also emphasized that Iraqis were prepared to defend themselves: "Thanks be to God, I'll tell the dear people of Iran that veterans and various forces - Sunnis Shias and Kurds all over Iraq - are ready for sacrifice."
Millions of Shi'ite pilgrims visit Iraq's holy sites each year. Iraqi government forces are holding out against Sunni fighters in the city of Samarra north of Baghdad, site of one of the most important Shi'ite shrines. The Sunni fighters have vowed to carry their offensive south to Najaf and Kerbala, seats of Shi'ite Islam since the Middle Ages.
The Baiji refinery is the fighters' immediate goal, the biggest source of fuel for domestic consumption in Iraq, which would give them a firm grip on energy supply in the north where the local population has complained of fuel shortages.
The refinery was shut on Tuesday and foreign workers flown out by helicopter. Elite Iraqi troops have repeatedly repelled attempts to capture it, even as the towns and cities in the area rapidly fell to the ISIL advance last week.
"The militants have managed to break in to the refinery. Now they are in control of the production units, administration building and four watch towers. This is 75 percent of the refinery," an official speaking from inside the refinery said.
The government's counter-terrorism spokesman, Sabah Nouri, insisted forces were still in control and had killed 50-60 fighters and burned 6 or 7 insurgent vehicles after being attacked from three directions.
Several sources described smoke billowing from the compound after parts of the refinery were hit. During the 2003-2011 U.S. occupation, the refinery stayed open, and the threat to it shows how much more vulnerable Iraq is now to insurgents than it was before Washington pulled out troops.
In a rerun of previous failed efforts at bridging sectarian and ethnic divisions, Shi'ite, Sunni and Kurdish leaders met late Tuesday behind closed doors. They later stood frostily before cameras as Ibrahim al-Jaafari, a Shi'ite politician who held the post of prime minister before Maliki, read a statement.
"No terrorist powers represent any sect or religion," Jaafari said in the address, which included a broad promise of "reviewing the previous course" of Iraqi politics. Afterwards, most of the leaders, including Maliki and Usama al-Nujaifi, the leading Sunni present, walked away from each other in silence.
Last week's sudden advance by ISIL - a group that declares all Shi'ites to be heretics deserving death and has proudly distributed footage of its fighters gunning down prisoners in mass graves - is a test for U.S. President Barack Obama, who pulled U.S. troops out of Iraq in 2011.
Obama has ruled out resending ground troops but is considering other military options to help defend Baghdad, and U.S. officials have even spoken of cooperating with Tehran against the mutual foe, a move that would be unprecedented.
But U.S. and other international officials insist Maliki must do more to address the widespread sense of political exclusion among Sunnis, the minority that ran Iraq until U.S. troops deposed dictator Saddam Hussein after the 2003 invasion.
"There is a real risk of further sectarian violence on a massive scale, within Iraq and beyond its borders," U.N. Secretary-General Ban Ki-moon said. "I have been urging Iraqi government leaders including Prime Minister al-Maliki to reach out for an inclusive dialog and solution of this issue."
Maliki, in power for eight years and effective winner of a parliamentary election two months ago, seems instead to be relying more heavily than ever on his own sect, who form a majority long oppressed under Saddam.
Though the joint statement late on Tuesday said only those directly employed by the Iraqi state should bear arms, thousands of Shi'ite militiamen have been mobilized to defend Baghdad.
According to one Shi'ite Islamist working in the government, well-trained organizations Asaib Ahl Haq, Khataeb Hezbollah and the Badr Organization are now being deployed alongside Iraqi military units as the main combat force.
With battles now raging just an hour's drive to the north of the capital, Baghdad is on edge. The city of 7 million people saw fierce sectarian street fighting from 2006-1007 and is still divided into Sunni and Shi'ite districts, some protected by razor wire and concrete blast walls.
Sunnis worry about convoys of civilian cars with bearded men in military uniform they believe are militiamen. Shi'ites living in Sunni districts are moving away, worried that a new round of civil war is unfolding.
Two attacks hit Shi'ite markets in Baghdad Tuesday, a suicide bomber and a car bomb. At least 18 people were killed and 52 wounded, according to medical and security sources. (Reporting By Ghazwan Hassan, Ahmed Rasheed, Ned Parker; Editing by Giles Elgood)