BAGHDAD, Iraq (CNN) -- Radical Shiite cleric Muqtada al-Sadr's movement has agreed to end its "armed presence" in Sadr City under an agreement reached with Iraq's government, Iraqi officials said Monday.
Men gather at the site of an airstrike in the Shiite stronghold of Sadr City in Baghdad, Iraq.
Both sides signed the agreement Monday, which was reached in principle on Saturday, fine-tuned on Sunday, and then approved by Prime Minister Nuri al-Maliki.
It calls for a four-day cease-fire to have begun Sunday, a day before it was formally approved. The agreement is an attempt to end the bloodshed in Baghdad's Sadr City neighborhood, a government official said Monday.
Despite the agreement, the U.S. military -- which was not part of the discussions -- continued to battle militants Sunday night into Monday morning in Sadr City, a stronghold of the radical Shiite cleric.
The U.S. military said three armed people were killed in the fighting. Violence between U.S. forces and militia members in Sadr City flared hours after the cease-fire was supposed to go into effect.
Iraq's deputy parliament speaker and a spokesman for al-Sadr's movement praised the agreement Monday during a joint news conference in Baghdad.
"Thanks to God for the agreement that we reached ... to end the crisis in Sadr City which left hundreds of martyrs and more than this number of wounded," said al-Sadr spokesman Sheikh Salah al-Obeidi.
It will end the militias' armed presence in the sprawling eastern Baghdad slum, he said, and clear the district of roadside bombs and mines that the United Nations Children's Fund says has rendered many roads inaccessible.
"The Sadr bloc expressed readiness to allow the government to search Sad City and other suspected places for weapons," Deputy Parliament Speaker Sheikh Khalid al-Attia. "The government has right to confiscate all weapons of that type (medium and heavy) according to the agreement."
He added that people "harmed" by the military operation in Sadr City will be compensated by the government.
A U.S. military official voiced his support of a cease-fire agreement on Sunday.
"We welcome an end to violence and putting an end to the criminal activity, so we are obviously in support of the government of Iraq as they move forward in a dialogue with elements of the Sad trend," said Rear Adm. Patrick Driscoll, a spokesman for the U.S.-led multinational forces.
Not all Shiite militants involved in the Sadr City fighting are members of al-Sadr's Mehdi army. The U.S. military has said the Shiite militias in Sadr City are Iranian-backed cells who have not obeyed al-Sadr's freeze of Mehdi army military activities. The cleric put the freeze in place in August and renewed it in February.
Iran denies backing violent groups in Iraq.
Iraqi and U.S. forces have battled Shiite militants in Sadr City since the end of March. About about 1,000 militants and civilians have been killed in fighting, and more than 2,000 have been wounded.
In a statement posted on an al-Sadr loyalist Web site, the cleric announced a five-member committee "with full authority to end the crisis in peaceful means and in a way they see as being in the interest of Iraq and the Iraqis."
During the four-day cease-fire, the government will reopen all entrances to Sadr City, allowing necessary aid to flow in and the wounded to be evacuated, al-Obeidi said. There are shortages of water, food and medical supplies there, according to UNICEF.
Iraqi security forces will maintain checkpoints at the entrances of Sadr City to prevent any infiltration.
Iraqi forces will also be on the district's streets, conducting searches and raids to detain wanted individuals, according to al-Obeidi, and he warned that according to the agreement, the government will punish the security forces if they violate residents' rights in the process.
Disbanding al-Sadr's Mehdi army was not even discussed, al-Obeidi said.
According to the spokesman, al-Sadr has reviewed the deal and agreed to it, issuing a statement on Monday authorizing a five-member delegation to sign the agreement.
CNN's Jomana Karadsheh, Christine Theodorou and Mohammed Tawfeeq contributed to this report.