* Kerry warns Maliki not to "stir waters" on new government
* Shi'ite coalition close to nominating prime minister
* Maliki remains defiant, complains to court over president
* Special forces loyal to Maliki deployed in key areas of Baghdad (Adds Abadi nominated)
By Michael Georgy
BAGHDAD, Aug 11 (Reuters) - Iraqi Prime Minister Nuri al-Maliki was battling to keep his job on Monday, deploying forces across Baghdad as erstwhile allies nominated a replacement and the United States warned him not to block popular demands for change.
With Sunni fighters from the Islamic State making new gains over Kurdish forces north of the capital, the United States hopes a consensus government can stem bloodshed that prompted the first U.S. air strikes since troops pulled out in 2011.
Widely accused of a partisan obstinacy that has fuelled the communal violence tearing Iraq apart, the Shi'ite Muslim premier went on television late on Sunday to denounce the ethnic Kurdish president for delaying the constitutional process of naming him prime minister following a parliamentary election in late April.
But fellow Shi'ites nominated Haider al-Abadi, a long-time Maliki ally, in his place as the struggle for the premiership descended into judicial wrangling and a power play on the streets of the beleaguered capital, where militias and special forces seen as loyal to Maliki took up strategic positions.
After Washington endorsed the efforts of President Fouad Masoum to break three months of political deadlock, Secretary of State John Kerry called on Maliki not to resort to force or "stir the waters" when Iraqis were seeking a change of leader.
The president formally asked Abadi to form a government.
But Maliki, lifted from obscurity to take office during the U.S. occupation in 2006, has made clear he will not go quietly.
In pointed remarks, Kerry said: "The government formation process is critical in terms of sustaining stability and calm in Iraq and our hope is that Mr. Maliki will not stir those waters.
"There will be little international support of any kind whatsoever for anything that deviates from the legitimate constitution process that is in place and being worked on now."
Kerry said Iraqis were looking for change. As police and elite armed units, many equipped and trained by the United States, locked down the capital's streets, he added: "There should be no use of force, no introduction of troops or militias in this moment of democracy for Iraq."
Complicating efforts to name a replacement from among fellow Shi'ites, who appear to have support from the country's leading cleric and from the Shi'ite establishment of neighbouring Iran, the highest court issued a written ruling to clarify rules on forming a government after an election. Its cautious wording was taken by many observers to favour Maliki's case.
Without naming any political group, the judges said that, under the constitution, the biggest group in parliament should be given the first opportunity to nominate a prime minister.
A key point is whether Maliki's State of Law is that biggest group or whether the designation belongs to a broader Shi'ite coalition known as the National Alliance, of which State of Law is part. The court, by referring to the rights of the biggest group that took part in a first session of the new legislature on July 1, seemed to favour Maliki, since the National Alliance failed to register as a parliamentary unit on that occasion.
Nonetheless, a spokesman for the Alliance said it had nominated Abadi, a deputy speaker of parliament and ally of Maliki in his Dawa party, to replace him as premier.
Serving in a caretaker capacity since the inconclusive election on April 30, Maliki has defied calls by Sunnis, Kurds, some fellow Shi'ites, regional power broker Iran and Iraq's top Shi'ite cleric to step aside for a less polarising figure.
Critics accuse Maliki of pursuing a sectarian agenda that has sidelined minority Sunni Muslims and prompted some of them to support Islamic State militants, whose latest sweep through northern Iraq has alarmed the Baghdad government and its Western allies, prompting U.S. air strikes in recent days.
"Maliki knows it is very difficult to gain a third term and is playing a high-stakes game to try and ensure his authority and influence continue into the new government, despite who may officially become prime minister," said Kamran Bokhari, a Middle East specialist at analysis firm Stratfor.
MALIKI UNDER FIRE
Washington is losing patience with Maliki, who has placed Shi'ite political loyalists in key positions in the army and military and drawn comparisons with Sunni tyrant Saddam Hussein, the man he plotted against from Iranian exile for many years.
A State Department spokeswoman reaffirmed Washington's support for a "process to select a prime minister who can represent the aspirations of the Iraqi people by building a national consensus and governing in an inclusive manner".
"We reject any effort to achieve outcomes through coercion or manipulation of the constitutional or judicial process," she said in a statement, adding that the United States "fully supports" Masoum as guarantor of Iraq's constitution.
U.S. President Barack Obama has urged Iraqi politicians to form a more inclusive government that can counter the growing threat from the Islamic State. It has capitalised on the political deadlock and sectarian tensions, making fresh gains after arriving in the north of the country in June from Syria.
The group, which sees Iraq's majority Shi'ites as infidels who deserve to be killed, has ruthlessly moved through one town after another, using tanks and heavy weapons it seized from soldiers who have fled in their thousands.
On Monday, police said the fighters had seized the town of Jalawla, 115 km (70 miles) northeast of Baghdad, after driving out the forces of the autonomous Kurdish regional government.
On Sunday, a government minister said Islamic State militants had killed hundreds of people from the small Yazidi religious sect, burying some alive and taking women as slaves.
No independent confirmation was available of the killings. Thousands of Yazidis have taken refuge in the past week on the arid heights of Mount Sinjar, close to the Syrian border.
The bloodshed could increase pressure on Western powers to do more to help tens of thousands of people, including many from religious and ethnic minorities, who have fled the Islamic State's offensive. Military action and aid are on the agenda for Washington and its European and other allies.
The U.S. Central Command said drones and jet aircraft had hit Islamic State armed trucks and mortar positions on Sunday near Arbil, the capital of the autonomous Kurdish region.
That marked a third successive day of U.S. air strikes, and Central Command said they were aimed at protecting Kurdish peshmerga forces as they face off against the militants near Arbil, the site of a U.S. consulate and a U.S.-Iraqi joint military operations centre.
WOMEN HELD AS SLAVES
Consolidating a territorial grip that includes tracts of Syrian desert and stretches toward Baghdad, the Islamic State's local and foreign fighters have swept into areas where non-Sunni groups live. While they persecute non-believers in their path, that does not seem to be the main motive for their latest push.
The group wants to establish religious rule in a caliphate straddling Syria and Iraq and has tapped into widespread anger among Iraq's Sunnis at a democratic system dominated by the Shi'ite Muslim majority following the U.S. invasion of 2003.
Iraqis have slipped back into sectarian bloodshed not seen since 2006-2007. Nearly every day police report kidnappings, bombings and execution-style killings. The Sunni militants routed Kurds in their latest advance with tanks, artillery, mortars and vehicles seized from fleeing Iraqi troops.
The militants are now just 30 minutes' drive from Arbil. In their latest sweep through the north, the Sunni insurgents seized a fifth oil field, several more villages and the biggest dam in Iraq - which could let them flood cities or cut off water and power supplies - hoisting their black flags along the way.
After spending more than $2 trillion on its war in Iraq and losing thousands of soldiers, the United States must now find ways to tackle a group that is even more hardline than al-Qaeda and has threatened to march on Baghdad. (Writing by Alastair Macdonald; Editing by Will Waterman and Peter Millership)
Our Standards: The Thomson Reuters Trust Principles.