* Maliki's reputation on the line as violence flares
* His State of Law slate set to win majority in Wednesday's election
* Opponents pledge to join forces to bar him from third term
By Ned Parker and Raheem Salman
BAGHDAD, April 29 (Reuters) - A casual wave to fellow diners in a Baghdad restaurant in 2008 sealed Nouri al-Maliki's reputation as the man who restored a degree of normality to a city that civil war had nearly destroyed.
Now he has gone out again among the people, strolling around the city to prove he is still attuned to their problems as he lobbied voters to give him a third term as prime minister when they cast their ballots in elections on Wednesday.
"These people standing outside waiting in the sun are suffering," he thundered at a vehicle registration office during the televised walkabout last month. "People in their offices with air conditioners over their heads don't feel their discomfort."
The highest levels of violence since Maliki took on the militias in 2008 are undermining his message. He still leads the election field, but his opponents are circling and could unseat him, if they can overcome considerable differences.
A year-long offensive by al-Qaeda inspired Sunni militants is moving ever closer to the capital and Shi'ite militia, often teamed with security forces, are taking revenge on Sunni communities, diminishing the stature of Maliki's Shi'ite-led government.
In March alone 180 civilians were killed and 477 were wounded in Baghdad among more than 2,000 killed across Iraq so far this year.
Normally seen behind closed doors and a wall of security, Maliki's usual message is vengeance for the bombings that have again become a regular feature of Iraqi life and criticism of political opponents, who he says are set on undermining him.
His concentration of power over the past eight years - he holds the defence, interior and security portfolios as well as the premiership - gives him a clear electoral advantage, as does the offensive against the Sunni militants he launched last year.
But it has also made him enemies among Shi'ite, Sunni and Kurdish leaders alike and his rivals say they are prepared to put sectarian differences behind them to unseat him.
"BEST OF THE WORST"
Maliki portrays himself as preventing Sunni extremists in Iraq's Anbar province and neighboring Syria from hurting the Shi'ites, a sharp contrast with his non-sectarian message at the last election in March 2010, a year and a half before U.S. troops withdrew.
His old language promising national unity has long since disappeared.
In a speech this month, Maliki accused his political foes of undermining the fight in Anbar that been at a stalemate for months. Some in Iraqi security estimate more than a thousand Shi'ite troops have been killed and thousands have deserted from the army, as regular Shi'ite soldiers complain their leadership has not provided them with the equipment and training to win.
"It is so saddening that, at the time our army faces these killers and criminals, it is being stabbed in the back by some politicians who accuse the army of lacking principles," Maliki said.
Iraqis, including from the Shi'ite majority, might wish for another leader, but many cannot imagine a replacement. Maliki is, in their words "the best of the worst".
His aides say the war against al Qaeda offshoot, Islamic State of Iraq and the Levant (ISIL) in Anbar province to the west of Baghdad is working to Maliki's advantage.
"Before Anbar, the Shi'ites weren't happy with public services and Maliki was portrayed as weak. After Anbar, people see him as a strongman. They think he is right to use force against these people. There is a sectarian flavor to it," said one of his senior advisers.
A Shi'ite tribal leader from northern Baghdad warned last week that any successor would have to rebuild a military leadership dependent on Maliki, with ISIL just 16 miles (26 km) from Baghdad, almost within reach of Shiite neighborhoods.
Al-Muwatin, or the Citizen, which groups two of his longtime rivals, the Islamic Supreme Council of Iraq and the movement of Shi'ite cleric Muqtada Sadr, say if Maliki stays, Iraq could fall apart. They are hoping a fragmented vote will give them the upper hand.
One of their frontrunners is Bayan Jabor, a former interior minister who Sunnis say allowed militias to run death squads under police cover in 2005 - a charge he refutes.
Jabor says Maliki has mismanaged the war, arguing that the prime minister's moment of greatness after he ended the civil war in 2008 has long passed.
"We are now in 2014 and we can't go back eight years," Jabr told Reuters. "I believe that the future of Iraq, under the current government's policies, will be fragmentation."
Maliki' Kurdish and Sunni opponents also nurse eight years of grievances against him.
They fault him for not sharing power with them in his second term after it had been agreed they were supposed to apportion the defense, interior and intelligence apparatus.
They are angry at his chasing his Sunni vice president and a finance minister out of Iraq with arrest warrants since U.S. troops left Iraq at the end of 2011.
Most of his rivals joined a vote of no confidence against him in 2012. It failed, but now they have regrouped, resentful of the power acquired by a man chosen in 2006 as a weak compromise candidate who everyone thought would be pliable.
There are indications Maliki's popularity as the Shi'ites' protector is starting to fray in the south, where they are the largest population. A crowd chanted "liar, liar" to Maliki in Nasiriya over a promise to build more housing.
Most worrying for the prime minister is that, after years of strain, Iraq's most senior Shiite clerics are starting to speak out against him.
Grand Ayatollah Basheer Najafi, one of the four most senior clerics, said at the weekend his followers should not vote for Maliki, due to the failed war effort in Anbar and corruption allegations swirling around his administration.
Millions look to guidance from the clergy but Najafi's influence is the least of the grand ayatollahs.
Up to now, Maliki has always beaten the odds - so much so, in fact, that some Iraqi politicians have dubbed him "the luckiest man".
He has relied on the fact he is the known quantity in a chaotic nation to hold on to power. This time, neither the United States nor Iran have signaled their approval or rejection of Maliki. Each puts a premium on stability and is likely to support whoever it feels can ensure the situation rapidly calms.
The senior Maliki adviser predicted the premier's share of parliament seats would likely jump to 90 from the 70 that his advisers were predicting before the Anbar offensive.
Late last year, Maliki's circle expected the Shi'ite public to voice dissatisfaction with the prime minister over his inability to stop Sunni militants or drastically improve the economy.
As the election approaches, observers say ordinary Iraqis are becoming aware of the failures of the Anbar campaign. But with no reliable opinion polls, it remains a mystery how they will vote.
A Western diplomat said an apparent large boost in Shi'ite support Maliki seems to have won over his confrontation in Anbar might not last. "As time goes on, if that conflict is not resolved or if visible progress is not made, there is a risk that the Shi'ite public will lose patience and start looking for other Shi'ite leaders."
If and when a leader emerges with serious support, Maliki is ready. He has tested opponents in extreme situations and been known to quote an old Iraqi saying: 'if someone has a fever, make it hotter'. His adviser described striking Anbar's insurgent-held city of Fallujah as one more card he could play in his quest to stay on.
Even his opponents concede that their own rivalries could undermine them: that the various Shiite, Kurdish and Sunni parties will bicker among themselves over lucrative posts.
The government is assembled as a package deal with a president, approved by a two-third majority, who then appoints the prime minister to form a government.
Held by the Kurds since 2005, the presidency has long been eyed by the Sunnis, contributing to a convoluted and potentially drawn out negotiation process which would benefit Maliki.
"Either it will be very quickly resolved or maybe take more than a year. It is dangerous ," said lawmaker Amir al-Kinani, from the Sadr movement.
"If this government continues as an emergency government (due to the war), people will pressure their blocs to accept Maliki."
Allies within his own State of Law slate could abandon him if they felt Maliki could not assemble a majority. They might nominate his national security adviser Falah Fayadh, former chief of staff Tareq Najem, or MP Haidar Abadi.
Candidates from Mutawin include Jabor, former vice president Adel Abdel Mehdi; and the secular Shi'ite Ahmed Chalabi. But they may hesitate if it means breaking Shiite solidarity to strike a government agreement with Sunnis and Kurds.
For Maliki, to leave office would mark the end of a long road in politics since his years in exile in Iran and Syria.
Having lost 67 relatives to Saddam, after 2003, Maliki dreamed of working on his orchards. Instead, he found himself in Baghdad. Now he faces what could prove his final chapter. But he is not ready to go.
(Additional reporting by Ahmed Rasheed; editing by Philippa Fletcher)