U.S. and Iraqi troops came under heavy gunfire after they captured an alleged Shiite militia leader Friday in the holy city of Karbala, prompting them to call in an airstrike in a battle that left some 17 militants dead, the military said.

The fighting in Karbala, 50 miles south of Baghdad, broke out after the joint U.S.-Iraqi force detained a man the military described as a rogue Mahdi Army commander and two other suspects during a pre-dawn raid.

The raid took place without incident, but a gunbattle began after the troops left the building and faced attackers wielding small-arms fire, machine guns and rocket-propelled grenades from three separate locations, the military said, adding that five militants were killed in the fighting.

U.S. special forces called in attack aircraft after militants fired on a helicopter assisting the operation and about a dozen militants were killed in an airstrike, the military said.

Local Iraqi officials said nine people were killed, including four militiamen and five civilians, and 23 people were wounded in the fighting, which also damaged four or five houses, including one that was flattened. But the military disputed that claim, saying "no Iraqi civilians were present in the area while the strike was performed."

The military said the primary suspect detained commanded a Mahdi Army assassination cell that had broken off from the mainstream organization, which is loyal to radical Shiite cleric Muqtada al-Sadr. He was accused of being behind roadside bomb and mortar attacks against U.S. forces, including some employing armor-piercing explosively formed penetrators, or EFPs, as well as the assassinations of two Iraqi government officials.

The military statement did not identify the suspect, but a local policeman and a council member said militia leader Razzaq al-Ardhi had been detained along with his brother.

The officials, who spoke on condition of anonymity because they weren't authorized to release the information, said another clash erupted about three hours later as residents were removing the dead bodies from the hospital. Militiamen with the mourners briefly fought with a joint Iraqi army and police patrol, but no casualties were reported, the officials said.

U.S. and Iraqi officials have said they are unsure of the degree of control the anti-American cleric still exerts over his militia, which he founded in 2003 after the collapse of Saddam Hussein's rule and which engaged in fierce battles with U.S. troops in 2004. Last year, al-Sadr himself had complained publicly about "deviant" groups that were using the Mahdi Army as a cover for murder, extortion and smuggling.

In Baghdad, cleanup crews used tractors and cranes to clear out the debris after a highly sophisticated simultaneous truck bombing and rocket attack devastated a Shiite market district in one of the capital's safest central neighborhoods Thursday. Rescue workers pulled three more bodies from the rubble, and police raised the casualty toll to at least 31 people killed and 104 wounded.

Mourners streamed into mosques and funeral tents were set up in the neighborhood's main street, where black banners were hung on the walls with names of the dead.

Crowds of residents angry about the lack of security in the neighborhood -- which also was hit by a double car bombing earlier this week -- started throwing stones and empty cans at U.S. soldiers arriving at the site of the blast, causing them to leave the area, according to a police officer and a witness, who declined to be identified because they feared retribution.

They said Iraqi soldiers met with the same response when they arrived about 10 minutes later, prompting them to open fire to disperse the crowd, but no casualties were reported.

Although suicide bombings are common in Iraq, it is rare for militants to stage such a complicated attack with such effectiveness. The attackers struck about 6:40 p.m. as the Karradah district's market area was packed with shoppers on the eve of the Islamic day of rest.

Police said an explosives-laden garbage truck exploded near the market at about the same time as a Katyusha rocket slammed into a three-story residential building about 100 meters (yards) away. Three columns of smoke billowed into the sky and fires burned on the ground after the thunderous explosions, which set cars and buildings ablaze.

An Iraqi military spokesman, Brig. Gen. Qassim al-Moussawi, later blamed Sunni extremists for the rocket attack. He did not mention the car bombing reported by police. An Interior Ministry official, who also spoke privately because he lacked the authorization to talk to the media, said it was a triple attack with two car bombs -- a gray Opal and a white Toyota -- and a rocket.

The conflicting accounts could not be independently reconciled as the area was placed under a security cordon.

The unrelenting violence against Iraqis continued Friday when a roadside bomb exploded in Muqdadiyah, about 90 kilometers (60 miles) north of Baghdad, killing five civilians, police said.

The U.S. military also said another American soldier was killed Thursday by a roadside bomb in the restive Diyala province, where operations are under way to clear the area of Sunni insurgents north and east of Baghdad, the military said.

At least 65 U.S. troops have died this month, a relatively low number compared with American death tolls of more than 100 for each of the previous three months, according to an AP count based on military statements.

The No. 2 commander in Iraq, Lt. Gen. Ray Odierno, expressed cautious optimism about the downturn on Thursday. He said it appeared that casualties had increased as U.S. forces expanded operations into militant strongholds as part of the 5-month-old security crackdown aimed at clamping off violence in the capital, but were going down as the Americans gained control of the areas.

"We've started to see a slow but gradual reduction in casualties, and it continues in July," he said at a news conference. "It's an initial positive sign, but I would argue we need a bit more time to make an assessment whether it's a true trend."

Nevertheless, the daily average for U.S. troop deaths so far in July is 2.46 -- higher than the daily average of 2.25 last year.