(Refiles to remove garble from headline)
By Timour Azhari, Amina Ismail and Ahmed Rasheed
BAGHDAD (Reuters) -Helped by buoyant oil prices and a period of political calm at home and in the region, Iraq appears more stable than any time since the U.S.-led invasion, although the government's bid to cement gains with a budget splurge may prove a shaky foundation.
In office since October, Prime Minister Mohammed Shia al-Sudani has launched a programme to rebuild infrastructure and attract foreign investors, but analysts say the plans are at risk from an uncertain oil price outlook and face the challenge of maintaining delicate diplomacy in a volatile region.
"We are positive in the short-term outlook but medium to longer-term there are major challenges," said one Western diplomat.
Brought to power by Shi'ite Muslim groups backed by neighbouring Iran, Sudani passed his first major test this week by getting the state budget through parliament.
He has also performed a tricky diplomatic balancing act in handling relations with archrivals Iran and the United States.
Sudani won Washington's praise by implementing demands to stop dollars being smuggled to Iran in violation of U.S. sanctions, yet has kept Tehran's allies in Iraq happy with a state hiring spree and plans for major projects to create new work opportunities for militiamen, many from Iran-backed groups, now that their fight against Islamic State has been won.
A lawmaker from Iraq's majority Muslim Shi'ite community, who backs Sudani, said the prime minister was working "as a successful diplomat who can keep good relations with the West and Americans and at the same time make sure to send positive messages to Tehran."
The lawmaker, who declined to be named so he could speak freely about the prime minister, said Sudani's Iran-aligned backers saw him as a man who would act as a manager to improve basic services while shielding their interests.
UNRESOLVED PROBLEMS
Government foreign affairs adviser Farhad Alaaldin said Sudani served all Iraqis not just those allied to Iran.
"It's been a long while since we enjoyed this sort of political stability where the crises we face are dealt with in meeting rooms and under the roof of parliament and not outside," Alaaldin said.
It is a dramatic shift from last year, when rivalry between Shi'ite groups blocked the formation of a government, leading to violence and stoking fears of civil war in a nation that has suffered from conflict and chaos since the 2003 invasion.
The calm is mirrored in other areas of the Middle East where predominantly Shi'ite Iran and mainly Sunni Muslim Saudi Arabia have reestablished ties, easing a rivalry that has often played out across the region.
Yet, analysts say many of Iraq's problems remain unresolved, ranging from its heavy dependence on oil revenues and the volatile global energy market to graft and sectarianism.
"The system of corruption and political patronage is entrenched and has stifled any reform attempts for the past 20 years," said Renaud Mansour, director of the Iraq Initiative at London's Chatham House think tank, adding that a state hiring spree was not a "sustainable fix".
He said Iraq could easily be destabilised by problems beyond its borders, calling the country a "playground for regional and global problems". However, he said detente between Saudi Arabia and Iran "potentially gives Iraq some space to breathe."
Iraq remains vulnerable to geopolitical shocks, including in the Kurdish-controlled north, where rival parties are feuding. Turkey and Iran have mounted military operations against Kurdish militant groups there, saying they threaten their national security.
FINANCIAL LARGESSE
Challenges abound elsewhere too. Last year's fears about civil war only abated when populist Shi'ite cleric Muqtada Sadr stepped back from politics and his huge number of followers moved off the streets. But he has stepped back before and analysts say could fire up the street again if he sought a return.
Nevertheless, Sudani has had successes. His budget was passed after tough negotiations to win the backing of Shi'ite, Kurdish and Sunni Arab factions.
But the budget, Iraq's biggest, forecasts spending of 198.9 trillion dinars ($153 billion) with plans to add more than 500,000 workers to an already bloated bureaucracy, flying in the face of recommendations from the International Monetary Fund.
Most families rely on income from relatives with state jobs - difficult to cut if oil prices fall and state revenues slide.
Seeking to strengthen the economy, Sudani has courted foreign investment, including reviving a $27 billion deal with France's TotalEnergies and QatarEnergies to develop oil and gas output.
His diplomatic initiatives, meanwhile, have included visits to Germany, France and Saudi Arabia. But notably he has secured support from the United States, which has 2,500 soldiers in Iraq to advise and assist in fighting remnants of Islamic State.
U.S. Assistant Secretary of State for Near Eastern Affairs Barbara Leaf said the government's agenda of economic reform and the drive against corruption was "exactly what the doctor ordered".
"We will support this government working through those steps," she said in Baghdad in May, calling Iraq a place for cooperation rather than a "battleground".
(Reporting by Timour Azhari, Amina Ismail and Ahmed Rasheed in Baghdad; writing by Timour Azhari; Editing by Tom Perry; Editing by Edmund Blair)