The intervention into the Najaf crisis of Iraq's most senior Shia cleric, Ayatollah Ali Sistani, has raised hopes that the three-week standoff in the city can finally be ended.
Sistani commands the loyalty of the majority of Iraqi Shia
His peace initiative appears to have borne fruit with a deal supported by both rebel fighters and the interim government.
But violence continued in the hours leading up the negotiations and there is uncertainty over the intentions of the radical young cleric, Moqtada Sadr, whose ambitions represent a challenge to the ayatollah - as well as to the new Iraqi government in Baghdad.
The outline of a compromise has been clear for some time:
- Both sides should stop fighting and pull back from Najaf's old city
- Responsibility for the Imam Ali shrine should return to Ayatollah Sistani and the three other grand ayatollahs who form the city's top religious leadership
- Responsibility for security should be taken over by the Iraqi police
These points appear to be in the peace agreement and two new factors increase the chances of the deal sticking.
First, the plan now has the personal authority of Ayatollah Sistani, without doubt the most revered figure among the Iraqi Shia.
And, second, the timing of the ayatollah's intervention is particularly opportune.
There are signs that Mr Sadr's militiamen have been worn down by the relentless pressure of American and Iraqi government forces.
The people of Najaf are exhausted, and the various parties may now be more amenable to a face-saving solution.
The 24-hour ceasefire announced by the Iraqi authorities as Ayatollah Sistani arrived in Najaf opened a window of opportunity.
The ayatollah and the rebel
The elderly ayatollah and the radical young cleric have always eyed one another warily.
Mr Sadr's officials mock the ayatollah's caution in political matters.
Some Shia accuse Mr Sadr's Mehdi Army of strong-arm tactics
And they are not above referring to his Iranian origins and presenting Mr Sadr, in contrast, as a home-grown son of Iraq.
For their part, Ayatollah Sistani's representatives make no secret of their view that Mr Sadr is an upstart trading on the name of his illustrious father - a much-revered ayatollah assassinated when Saddam Hussein was in power.
There is no doubt as to who is the more senior figure in religious terms.
Ayatollah Sistani has a unique authority and commands the allegiance of the majority of the Shia faithful.
But, equally, Mr Sadr's two rebellions this year - in April and in August - have boosted his support and shown the resilience of his Mehdi Army.
It enjoys a degree of grass-roots support, not only in southern Iraq but also in Sadr City, the sprawling Baghdad suburb named after Mr Sadr's father.
It is also more than just a militia. In areas where it succeeds in asserting its authority, it sets up town councils and religious courts.
At the local level, there are certainly some Iraqi Shia who dislike Mr Sadr's militiamen, whom they accuse of strong-arm tactics.
And there are some who are apprehensive about Mr Sadr's confrontational approach to the US military presence in Iraq.
But among a minority of Iraqi Shia, especially the young, the unemployed and the disaffected, he is a hero who commands steadfast loyalty.
Many analysts believe that, whatever happens in Najaf, the Sadr phenomenon is here to stay.