(Adds Iraq government statement on Saudis, U.N.'s Ban)
* Fighting shuts main oil refinery
* Government forces say they have repelled attack on Baquba
* Dead include prisoners from local jail
* No sign Maliki responding to U.S. pressure to reach out to Sunnis
* Strong statement about Saudis risks inflaming regional anger
By Ned Parker
BAGHDAD, June 17 (Reuters) - Iraq's Shi'ite rulers defied Western calls on Tuesday to reach out to Sunnis to defuse the uprising in the north of the country, declaring a boycott of Iraq's main Sunni political bloc and accusing Sunni power Saudi Arabia of promoting "genocide".
Washington has made clear it wants Prime Minister Nuri al-Maliki to embrace Sunni politicians as a condition of U.S. support to fight a lightning advance by forces from the Islamic State of Iraq and the Levant.
But the Shi'ite prime minister has moved in the opposite direction, announcing a crackdown on politicians and officers he considers "traitors" and lashing out at neighbouring Sunni countries for stoking militancy.
The latest target of his government's fury was Saudi Arabia, the main Sunni power in the Gulf, which funds Sunni militants in neighbouring Syria but denies it is behind ISIL.
"We hold them responsible for supporting these groups financially and morally, and for the outcome of that - which includes crimes that may qualify as genocide: the spilling of Iraqi blood, the destruction of Iraqi state institutions and historic and religious sites," the Iraqi government said of Riyadh in a statement.
Maliki has blamed Saudi Arabia for supporting militants in the past, but the severe language was unprecedented. On Monday Riyadh blamed sectarianism in Baghdad for fuelling the violence.
In the latest bloodshed, scores of Iraqis were killed on Tuesday during a battle for a provincial capital, and fighting shut the country's biggest oil refinery, starving parts of the country of fuel and power.
Government forces said they repelled an attempt by insurgents to seize Baquba, capital of Diyala province north of Baghdad, in fighting overnight. Some residents and officials said the dead included scores of prisoners from the local jail. There were conflicting accounts of how they had died.
ISIL fighters who aim to build a Caliphate based on mediaeval Sunni precepts across the Iraqi-Syrian frontier launched their revolt by seizing the north's main city, Mosul, last week and swept through the Tigris valley towards Baghdad.
The fighters, who consider all Shi'ites to be heretics deserving death, pride themselves on their brutality and have boasted of massacring hundreds of troops who surrendered.
Most Iraqi Sunnis abhor such violence, but nevertheless the ISIL-led uprising has been joined by other Sunni factions, including former members of ousted dictator Saddam Hussein's Baath Party and tribal figures, who share widespread anger at perceived oppression by Maliki's government.
Western countries, including the United States, have urged Maliki to reach out to Sunnis to rebuild national unity as the only way of preventing the disintegration of Iraq.
"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 on Tuesday. "I have been urging Iraqi government leaders including Prime Minister al-Maliki to reach out for an inclusive dialogue and solution of this issue."
But the long-serving prime minister, who won an election two months ago, seems instead to be relying more heavily than ever on his own sect, who form the majority in Iraq.
Hassan Suneid, a close Maliki ally, said on Tuesday the governing Shi'ite National Alliance should boycott all work with the largest Sunni political bloc, Mutahidoon.
"It is not possible for any bloc inside the National Alliance to work with Mutahidoon bloc due to its latest sectarian attitude," he told a TV channel of Maliki's party.
The sudden advance by Sunni insurgents has the potential to scramble alliances in the Middle East, with the United States and Iran both saying they could cooperate against a common enemy, all but unprecedented since the 1979 Iranian revolution.
Iran, the leading Shi'ite power, has close ties to Maliki and the Shi'ite parties that have held power in Baghdad since U.S. forces toppled Saddam Hussein in 2003. But although both Washington and Tehran are close allies of Baghdad, they have not cooperated in the past.
In a diplomatic rapprochement, U.S. ally Britain said it planned to reopen its embassy in Tehran, two and a half years after a mob ransacked the mission.
U.S. officials say they could discuss Iraq with Iranians on the sidelines of nuclear talks in Vienna this week.
President Barack Obama, under fire at home by critics who say he did too little to shore up Iraq since withdrawing U.S. troops in 2011, is considering options for military action such as air strikes. He has sent a small number of extra marines to guard the U.S. embassy but has ruled out redeploying troops.
"The president will continue to consult with his national security team in the days to come," the White House said, without elaborating. A senior U.S. official said Obama had not yet decided on a course of action.
Iraqi officials confirmed that the Baiji refinery north of Baghdad had shut down, although they said government troops still held the vast compound. Foreign workers were evacuated by Iraqi government helicopters.
With the refinery shut, Iraq will have difficulty generating electricity and pumping water to sustain its cities in summer. There were already reports of queues for fuel in the north.
During the 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.
Tens of thousands of Shi'ites have rallied at volunteer centres in recent days, answering a call by the top Shi'ite cleric to defend the nation. Many recruits have gone off to train at Iraqi military bases.
But with the million-strong regular army abandoning ground despite being armed and trained by the United States at a cost of $25 billion, the government is increasingly relying on extra-legal Shi'ite militia to fight on its behalf, re-establishing groups that fought during the 2006-2007 bloodletting.
According to one Shi'ite Islamist working in the government, well-trained fighters from the Shi'ite organisations Asaib Ahl Haq, Khetaeb Hezbollah and the Badr Organisation are now being deployed as the main combat force, while new civilian volunteers will be used to hold ground after it is taken.
The Sunni militants have moved at lightning speed since seizing Mosul last Tuesday, slicing through northern and central Iraq, capturing the towns of Hawija and Tikrit in the north before facing resistance in southern Salahuddin province, where there is a large Shi'ite population.
The battle lines are now formalising, with the insurgents held at bay about an hour's drive north of Baghdad and just on the capital's outskirts to the west.
State television said Iraqi security forces repelled attacks on three neighbourhoods overnight in Baquba, capital of Diyala, an ethnically and religiously mixed province that saw some of the worst violence of the 2003-2011 U.S. occupation.
Militants also attacked a northern Iraqi village, called Basher, 15 km (9 miles) south of Kirkuk, inhabited by Shi'ite ethnic Turkmen. They were repelled, police said.
Kirkuk itself has been taken by forces from the autonomous Kurdish region. In a further sign of ethnic and sectarian polarisation, Maliki allies have accused the Kurds of colluding with Sunnis to dislodge government forces in the north.
The mainly Turkmen city of Tal Afar, west of Mosul, fell to Sunni militants late on Sunday, and the Iraqi military said it was sending reinforcement there. The Iraqi army said on state television it had killed a top militant, named Abu Abdul Rahman al-Muhajir, in Mosul in clashes.
But security officials seemed pessimistic about the situation in Mosul. One Iraqi security officer warned: "There is no clear strategy for the Iraqi government to retake Mosul. And without the US and international community support, the Iraqi government will never retake Mosul." (Editing by Peter Graff and Giles Elgood)
Our Standards: The Thomson Reuters Trust Principles.