A curfew was imposed on the city on Sunday morning as fighting broke out between security forces and the fighters. A US tank was destroyed in the fighting.
Seven civilians were wounded in the clashes, one of them critically, local medics said. The US military reported no casualties.
The battles broke out after a joint Iraqi and US force tried to arrest a local Shia militia leader accused of slaughtering Iraqi soldiers during a previous clash in August, officials said.
“Iraqi army and Multi-National Division Baghdad (MND-B) soldiers killed approximately 30 terrorists and detained a high-value target after a terrorist attack today in Diwaniyah, south of Baghdad,” a military statement said.
An Iraqi defence official named the suspect as Kifah al-Greiti, a local commander in the Mahdi Army of Shia leader Moqtada al-Sadr.
The area has come under the influence of Jaish al-Mahdi (the Mahdi Army), a militia loyal to al-Sadr.
A spokesperson for the US-led forces said that the tank that was destroyed was an M1A2 second-generation Abrams.
The tank is seen as the most heavily armoured operating in Iraq.
US soldiers sealed off roads to the city in an apparent attempt to keep the fighters from getting reinforcements.
Fighting broke out after a joint US-Iraqi unit raided the house of al-Graiti, an al-Mahdi Army commander in the city, Fatiq Ayid, an Iraqi army captain, said.
The US command in Baghdad had no immediate comment on the fighting.
Diwaniya, 130km south of Baghdad, was the scene of a fierce fight in August between the the Mahdi Army and Iraqi forces that left 23 Iraqi soldiers and 50 militiamen dead and scores more wounded.
Mahdi Army account
Speaking to Aljazeera, Sheikh Abdul-Razaq al-Nidawi, the head of al-Sadr’s office in Diwaniya, said: “The clashes erupted when massive US tanks and Hummers stormed into the city at 2am on Sunday.
“We had indirectly agreed with the US forces through a co-ordinator from the Iraqi premiership that US forces would not enter the city, particularly after the clashes that took place 20 days ago.
“But we were surprised that so many convoys of US tanks and vehicles entered the city.
Al-Nidawi denied claims by the US army that between 20 and 30 militiamen were killed. “The reports are groundless and these are just lies by the US army to cover the losses it suffered.
“The US army said earlier that it had killed about 50 people during the clashes that took place 20 years ago, yet there were only two Jaish al-Mahdi fighters who died,” al-Nidawi said.
“There was no one killed from Jaish al-Mahdi during these clashes and only three people were injured.
“Because of the existing agreement, the US army must not enter the centre of Diwaniya and carry out random arrests and raids.
“If US forces did not storm into the city, we would not have confronted them and adopted the resistance agenda. But our leader Sayyed Moqtada al-Sadr recommended we resort to political and peaceful resistance.
“The US forces are trying to drag the al-Sadr movement into full-fledged armed showdown but we won’t be drawn into such a confrontation.”
Meanwhile, the bodies of 51 unidentified people have been found across the capital in the past 24 hours, according to Iraqi police.
A US soldier died in northwest Baghdad when fighters attacked a patrol with small-arms fire, the US military said on Sunday.
There has been a recent rise in the number of US casualties with more than a score of US servicemen killed during the past week.
Nizar al-Samaraei, an Iraqi political analyst in Baghdad, told Aljazeera that although the curfew currently in force in the Iraqi capital had proved effective for security, it was causing hardships to the local population.
“Sick people cannot go to hospitals unless police forces intervene to transfer them. This leads to the death of more Iraqis as some of them may be in very critical conditions.
“Also, the security measures implemented during a curfew, paralyse economic life, thereby further worsening Iraqi citizens’ impoverished state.”
Elsewhere in Iraq, a separate curfew in the northern city of Kirkuk has been lifted. Authorities said that 150 people were arrested and 500 weapons confiscated in the city during a US clampdown.
In parliament, the immunity from prosecution of a Sunni politician accused of pocketing millions of dollars via a project to secure Iraq‘s northern oil pipelines was lifted.
The step to remove the lawmaker’s legal immunity was unprecedented but largely symbolic as he is no longer in Iraq.
Oil revenues account for 95 per cent of the government’s budget.