When loudspeakers atop the golden minarets of the Imam Ali shrine broadcast orders Friday morning demanding that fighters in Najaf surrender their weapons, Saad Muslim promptly complied. He walked over to rebel cleric Moqtada Sadr's militia headquarters and deposited his sniper rifle onto a pile of firearms and rocket-propelled grenades.

Then he slipped out of this battle-scarred city. After three weeks of fighting U.S. and Iraqi security forces at the behest of Sadr, Muslim simply changed out of his black Mahdi Army militia uniform and melted into a crowd of Shiite pilgrims heading back to the Baghdad slum where he lives.

But should the mercurial Sadr beseech his followers to take up arms again, Muslim vowed to comply without hesitation. "If Moqtada asks us to return to fight, if he needs us anytime, we will obey," said Muslim, an unemployed 31-year-old with thick arms and a thin beard. "We will run back with our guns and fight again. We are all at his service."

The agreement, brokered by Iraq's top Shiite religious leader, Grand Ayatollah Ali Sistani, that ended the tense confrontation between the Mahdi Army militia and security forces contains a serious loophole: It gives Sadr and his supporters the chance to fight another day.

In exchange for vacating the shrine and the rest of Najaf, Sadr's supporters received what amounted to a full amnesty. They were allowed to return home by joining a throng of pilgrims streaming through the city. Sadr was informed in a statement by a government cabinet minister that he was "free as any Iraqi citizen to do whatever he would like."

"The winner in all this is Moqtada," said an Arab diplomat who has close relations with Iraq's interim government. "The agreement allows him and his people to walk free -- and that's a recipe for further trouble."

Unlike other strife-torn nations that have tried to demobilize militias, Iraq has not earmarked any money for financial incentives, job-training programs and other measures to dissuade members of the Mahdi Army, most of whom have no jobs and little education, from regrouping.

A U.S.-funded effort to dismantle militias in Iraq with stipends and training programs does not apply to the Mahdi Army. Sadr never signed a demobilization agreement with the U.S. occupation authority, which directed funds toward paramilitary groups, such as the Kurdish pesh merga and the Shiite Badr Brigades, allied with the United States. A more recent Iraqi government initiative to spend $200 million to improve living conditions in Najaf and Baghdad's Sadr City, a Mahdi Army stronghold, includes no funding for dismantling the militia.

"You cannot expect these young men to distance themselves from the militia unless there is a program that will give them a chance to earn a decent living and improve their living conditions," said Jamal Benomar, a senior U.N. political adviser to the interim government. "They're a group of people with no jobs and no future. The same reasons that led them to join this movement still exist."

Iraqi government officials contend that the nature of Sadr's militia makes it impossible to provide financial emoluments to individual members. The militia, they note, does not have clear membership rolls. Most participants are volunteers who pick up arms when summoned by Sadr.

Government officials said a requirement that Mahdi Army members turn in weapons before leaving Najaf would make it more difficult for the militia to regroup. But Iraq is awash in cheap guns. For militiamen who do not have spare weapons at home, purchasing an AK-47 assault rifle requires only about $50.

It was not clear whether the weapons being surrendered in Najaf would be turned over to the police, as the government demanded. Wooden trolleys piled with guns and ammunition and covered with blankets were pushed out of the militia headquarters.

"We will not hand over our weapons to the police," said Hatef Hussein, a guard at the militia headquarters. If commanders "want to keep it for the future in case things don't work out, it's their choice."

When fighting between Sadr loyalists and U.S. forces began in early August -- sparked by a Mahdi Army attack on a police station in Najaf -- Iraq's interim prime minister, Ayad Allawi, and several of his closest cabinet ministers wanted to crush the militia. The attack on the police station broke a truce reached in June after more than two months of often-intense battles between the Mahdi Army and the U.S. military. Another deal, Allawi reasoned, would simply provide another chance for Sadr to renege.

Allawi's attitude was shared by senior U.S. military commanders and diplomats in Iraq, who were also mindful of Sadr's record of non-compliance.

But the Mahdi Army proved to be a tougher opponent than Iraqi and U.S. officials had anticipated. By holing themselves up in and around the shrine -- one of Shiite Islam's holiest sites -- the militiamen forced U.S. troops to moderate their offensive. When the militiamen wanted to regroup or rest, they could retreat into the safety of the shrine, which was off-limits for U.S. gunners.

The standoff and reports of collateral damage to the shrine -- which U.S. military officials contend was caused by misfired Mahdi Army mortars -- sparked growing anger among Iraq's majority Shiites, forcing Allawi's government to pursue a settlement. Among the government's demands was that all militia weapons be handed over to the police.

But when a delegation of Iraqi leaders affiliated with the government was unable to obtain Sadr's consent, Allawi yielded to an initiative by Sistani. His plan did not include a provision obligating the Mahdi Army to turn in its weapons.

Iraqi and U.S. officials said the settlement nevertheless left Sadr in a much weaker position. Hundreds of his militiamen have been killed and wounded. Moderate Shiite leaders have asserted control over the shrine. And without the sanctuary of the shrine, the senior U.S. official said, if Sadr "steps out of line somewhere else, you can roll over him with a tank."

Even if U.S. forces had been able to kill or capture all the militiamen in Najaf, a senior U.S. official doubted they would have crushed the Mahdi Army. Thousands of fighters from Sadr's stronghold in a Baghdad slum would have joined the militia, he said, "making the problem even worse."

Perhaps mindful of flaws in the deal, the U.S. Embassy here sought to distance itself from the outcome on Friday. Embassy spokesman Robert Callahan praised the government for displaying "patience and restraint throughout," but he emphasized that Iraq's interim leaders were "in charge throughout the standoff."

"The United States provided extensive military and logistical support, but the Iraqi interim government made the decisions," he said.

Special correspondent Naseer Nouri in Najaf contributed to this report.

A member of the Mahdi Army militia acknowledges Shiite pilgrims marching in Najaf toward the Imam Ali shrine.A Mahdi Army member mingles with the faithful in Najaf, where guns fell silent following a truce negotiated by Grand Ayatollah Ali Sistani.