* Troops massing around Samarra, officials see push back
* Obama offers 300 military advisers, presses political solution
* Senior Shi'ite cleric urges new government
* Prime Minister Maliki criticised in Washington
* Fighting continued around Baiji refinery
President Barack Obama offered up to 300 Americans to help coordinate the fight. But he held off granting a request for air strikes from the Shi'ite-led government and renewed a call for Prime Minister Nuri al-Maliki to do more to overcome sectarian divisions that have fuelled resentment among the Sunni minority.
Speculation that Maliki might be forced aside was heightened when the country's senior Shi'ite cleric urged a speedy formation of a new government following the ratification this week of the results of a parliamentary election held in April.
Maliki's Shi'ite bloc won the most seats but, with stalemate among Shi'ite, Sunni and ethnic Kurdish groups, the new assembly has yet to sit. Grand Ayatollah Ali al-Sistani wrote in a Friday sermon that a constitutional deadline for convening to choose a new prime minister and government should be respected.
In office since 2006, Maliki has irritated Washington by the way he has alienated Sunnis and there has been speculation he has also lost the confidence of allies in Iran as Tehran and the United States look to end decades of mutual hostility to prevent anti-Western, anti-Shi'ite zealots taking over Iraq.
In the area around Samarra, on the main highway 100 km (60 miles) north of Baghdad, which has become a frontline of the battle with the Islamic State of Iraq and the Levant, the provincial governor, a rare Sunni supporter of Maliki, told cheering troops they would now force ISIL and its allies back.
A source close to Maliki told Reuters that the government planned to hit back now that it had halted the advance which saw ISIL seize the main northern city of Mosul, capital of Nineveh province, 10 days ago and sweep down along the Sunni-populated Tigris valley toward Baghdad as the U.S.-trained army crumbled.
Governor Abdullah al-Jibouri, whose provincial capital Tikrit was overrun last week, was shown on television on Friday telling soldiers in Ishaqi, just south of Samarra: "Today we are coming in the direction of Tikrit, Sharqat and Nineveh.
"These troops will not stop," he added, saying government forces around Samarra numbered more than 50,000.
This week, the militants' lightning pace has slowed in the area north of the capital, home to Sunnis but also to Shi'ites fearful of ISIL, which views them as heretics to be wiped out. Samarra has a major Shi'ite shrine.
Maliki had former dictator Saddam Hussein, overthrown by a 2003 U.S.-led invasion, hanged three years later for killings of Shi'ites in nearby Dujail.
The participation of Shi'ite militias and tens of thousands of new Shi'ite army volunteers has allowed the Iraqi military to rebound after mass desertions by soldiers last week allowed ISIL to carve out territory where it aims to found an Islamic caliphate straddling the Iraqi-Syrian border.
"The strategy has been for the last few days to have a new defence line to stop the advance of ISIL," a close ally of Maliki told Reuters. "We succeeded in blunting the advance and now are trying to get back areas unnecessarily lost."
Pockets of fighting continue. Government forces appeared to be still holding out in the sprawling Baiji oil refinery, the country's largest, 100 km north of Samarra, residents said.
At Duluiya, between Samarra and Baghdad, residents said a helicopter strafed and rocketed a number of houses in the early morning, killing a woman. Police said they had been told by the military that the pilot had been given the wrong coordinates.
"TARGETED" U.S. ACTION
While a new reality is emerging with the key cities of Mosul and Tikrit for now out of reach for the government, Obama has put U.S. military power back at Baghdad's disposal, while insisting he will not send ground troops back, two and half years after he ended the occupation that began in 2003.
Announcing the despatch of advisers, the president said he was prepared to take "targeted" military action later if deemed necessary, thus delaying but still keeping open the prospect of air strikes to fend off a militant insurgency.
Obama also delivered a stern message to Maliki on the need to take urgent steps to heal Iraq's sectarian rift, something U.S. officials say the Shi'ite leader has failed to do and which ISIL has exploited to win broader support among the Sunnis.
"We do not have the ability to simply solve this problem by sending in tens of thousands of troops and committing the kinds of blood and treasure that has already been expended in Iraq," Obama told reporters. "Ultimately, this is something that is going to have to be solved by the Iraqis."
The contingent of up to 300 military advisers will be made up of special forces and will staff joint operations centres for intelligence sharing and planning, U.S. officials said.
Leading U.S. lawmakers have called for Maliki to step down, and Obama aides have also made clear their frustration with him.
While Obama did not join calls for Maliki to go, saying "it's not our job to choose Iraq's leaders", he avoided any expression of confidence in the embattled Iraqi prime minister.
Warning that Iraq's fate "hangs in the balance", Obama said: "Only leaders with an inclusive agenda are going to be able to truly bring the Iraqi people together."
Iraqis appeared content with Obama's decision. The Maliki ally said Obama's offer of aid was appropriate and included the establishment of an intelligence liaison centre that would allow for future U.S. air strikes on ISIL and other groups.
Obama's decision to hold off for now on such strikes underscored scepticism in Washington, and among its regional allies, over whether they would be effective, given the risk of civilian deaths that could further enrage Iraqi Sunnis.
"We will be prepared to take targeted and precise military action if we conclude the situation on the ground requires it," Obama said. But he insisted that any U.S. military response would not be in support of one Iraqi sect over another.
Maliki's Shi'ite alliance won the most votes in the elections, and U.S. officials said the Obama administration was pressing Iraqi authorities to accelerate the process of forging a new governing coalition and for it to be broad-based, including Sunnis and Kurds.
Anthony Cordesman, an expert at the Center for Strategic and International Studies think-tank in Washington, said Obama's decision guaranteed that the United States, not just Maliki's other key foreign allies in Shi'ite Iran, will have a presence on the ground during the Iraq crisis.
"It gives the United States the kind of direct contact with Iraqi forces that allows them to judge their strengths and weaknesses and act as a check on sectarian abuses," he wrote. "It keeps up the right kind of pressure on Maliki and any successor."