BAGHDAD - U.S.-led forces swooped into the Shiite militia stronghold of Sadr City on Wednesday, killing 32 suspected militants and detaining 12 others in fighting and an airstrike targeting alleged smuggling networks from Iran.

Iraqi police and witnesses said nine civilians were killed in the attack, which occurred hours before Prime Minister Nouri al-Maliki arrived in Tehran for his second visit in less than a year.

Iraq, which like Iran is majority Shiite, has managed a difficult balancing act between Tehran and Washington since the U.S.-led invasion in 2003, trying to maintain good relations with its powerful neighbor while not angering the Americans.

Iraqi authorities, meanwhile, clamped a three-day driving ban on the capital and erected new checkpoints as thousands of Shiite pilgrims began their annual trek toward a mosque in northern Baghdad to mark the anniversary of the death of one of Shiite Islam's key saints.

The military said the raid targeted fighters from breakaway factions of radical Shiite cleric Muqtada al-Sadr's Mahdi Army who smuggle arms from Iran and facilitate the travel of Iraqi militants to Iran for training.

"The individuals detained and the terrorists killed during the raid are believed to be members of a cell of a special groups terrorist network known for facilitating the transport of weapons and explosively formed penetrators, or EFPs, from Iran to Iraq, as well as bringing militants from Iraq into Iran for terrorist training," the military said.

The statement said the main suspect in the raid was a liaison between Iraqi fighters and Iran's elite Quds Force, which is accused of arming and training the militants. Tehran has denied allegations that it is supporting the violence in Iraq.

The military account of the raid said U.S. and Iraqi ground forces came under sporadic small-arms fire as they targeted a group of buildings in Sadr City, the sprawling Shiite district in eastern Baghdad. The raiders killed two armed men believed to be lookouts, then detained 12 rogue militia fighters, the military said.

Attack helicopters and warplanes then struck after spotting a vehicle and a large group of armed men on foot who were trying to attack the ground forces. An estimated 30 militants were killed in the air attack, according to the statement.

The statement was issued after Iraqi police and witnesses in Sadr City said a bombardment by U.S. helicopters and armored vehicles killed nine civilians, including two women, and wounded six others. The police officer and witnesses, who spoke on condition of anonymity because they feared reprisals, also said 12 people were detained.

Men and young boys wept over wooden coffins covered with blankets before they were placed atop vehicles, while women shrouded in black blamed the Americans for attacking civilians.

It was one of the largest in a series of strikes against rogue Shiite militias, which U.S. commanders have said are responsible for an increasing number of attacks against American forces.

The military also said U.S. and Iraqi troops had detained five rogue Shiite militia fighters along with three other suspects in the Baghdad neighborhood of Amil on Monday.

And U.S. soldiers south of the capital detained 10 Shiite militants who were allegedly part of a cell responsible for a series of rocket attacks against an American base, including one that killed a soldier last month, a statement said.

The U.S. second-in-command in Iraq, Lt. Gen. Raymond Odierno, has accused Iran of increasing its support to militants to try to upstage a September report on military and political progress in Iraq. He has said Shiite militants carried out 73 percent of the attacks that killed or wounded American troops in Baghdad in July.

Odierno's office also said Wednesday that EFPs were used to carry out 99 attacks last month -- an all-time high -- and accounted for a third of the nearly 70 U.S. combat deaths as well as 89 of the 614 troops who were wounded.

Those figures were nearly double the number in January, his office said.

Al-Sadr agreed to pull his Mahdi Army fighters off the streets as a U.S.-Iraqi security crackdown began Feb. 14 in Baghdad and surrounding regions, but disaffected members of the Mahdi Army have broken away from al-Sadr control. Dissident members of the militia said they went to Iran for training and armaments and returned to Iraq to join the fight against U.S. and Iraqi troops.

In Tehran, al-Maliki met with Iranian Vice President Parviz Davoodi and was to hold talks later with supreme leader Ayatollah Ali Khamenei, President Mahmoud Ahmadinejad and Ali Larijani, secretary of Iran's Supreme National Security Council, according to the Iranian state news agency IRNA.

"We want to promote economic ties and other ties that contribute to combating terrorism and its challenges," al-Maliki told The Associated Press on the plane to Iran.

He said Iraq and Iran "have a joint understanding that they are keen to solve the problems and sufferings of the Iraqi people. And they are both convinced that their cooperation may lead to helping Iraq and restoring stability."

It was al-Maliki's second visit to Tehran in less than a year, coming days after U.S. and Iranian experts held talks in Baghdad on improving Iraq's security.

In Baghdad, meanwhile, Iraqi forces intensified security ahead of a major Shiite holiday.

On Thursday, more than 1 million Shiite faithful -- flogging themselves with iron chains and slicing their foreheads with swords -- are expected to march toward the shrine of Imam al-Kadhim in Baghdad's Shiite Kazimiyah neighborhood. The ritual of grief banned under Saddam Hussein, and some Iraqi officials say up to 4 million may show up.

First-aid tents stocked with bottled water and food lined the streets as authorities scrambled to prevent a catastrophe from marring the ceremonies honoring Imam Moussa ibn Jaafar al-Kadhim, one of 12 principal Shiite saints who died in the year 799.

Sunni insurgents often target such religious gatherings. In 2005, the march was hit by tragedy when thousands of Shiite pilgrims, panicked by rumors of a suicide bomber, broke into a stampede on a bridge. About 1,000 people died.

The top U.S. ground commander in the area, Task Force Justice leader Lt. Col. Steve Miska, said hundreds of additional Iraqi security forces had been deployed in Kazimiyah, but that American troops would stay away from the shrine out of religious sensitivity.

"There's paranoia surrounding this shrine. If anything happened here, it'd make the Golden Dome look like a precursor," Miska said, referring to the al-Qaida bombing of Samarra's Askariya shrine, which destroyed the mosque's golden dome and set off a wave of sectarian bloodletting.

Brig. Gen. Qassim al-Moussawi, the Iraqi military spokesman, announced a curfew banning all cars, trucks, motorcycles and carts from moving on city streets that had been slated to begin at 10 p.m. Wednesday would begin 5 a.m. instead. It was to last until 5 a.m. Saturday.