The presence of the American military has also been a significant factor in the nation’s stability, along with the active participation of the largely Sunni neighborhood watch groups, known as the Awakening. But now the American military is stepping back and the Sunni guards, many of them former insurgents, are watching the government with skepticism, uncertain whether they have a political voice. It remains to be seen whether Mr. Maliki will be able to keep violence to an acceptable level.

“All this is against al-Maliki,” said Muayad Hamed, a doctor who has watched the politics of Shiite neighborhoods because he has worked on projects in Sadr City and other Shiite communities in Baghdad. “The rumor on the street is that after 30 June there will be more attacks to show that al-Maliki cannot work without the Americans and that all his power came from the Americans,” he said.

The scene on Wednesday evening at Imam Ali hospital, the largest in Sadr City, was one of mourning and chaos. Relatives and friends of the victims jammed the doors, pushing and shoving as they pleaded with hospital employees to let them search for loved ones. Many of those who had managed to enter received only sad news. Women wailed in grief as they discovered that their sons or husbands had been killed.

One, Um Ali, blamed the government. “Where are the promises of the government; they said we are going to do things better,” she said as she waited to see her sons, both of whom had been badly wounded. “Look at what they’ve done. They have done nothing for us. It just goes from worse to worse.”

Others accused the people they thought had carried out the attacks. “People who don’t fear God did this, the terrorists,” said Ali Abbas, near tears as he stood next to one of his brothers, who was badly wounded. He said he believed that another brother had also been hurt in the attack.

Haider Kadhim, 34, who had a badly injured leg, spoke in a low tone as if he could not believe what happened. “Me and my friend went to the market because there was no electricity at home and it was too hot,” he said, “so we went out and were just hanging out, and now I’ve lost my friend. He died.

“We should have stayed home,” he said.