Shiite militiamen loyal to anti-American cleric Muqtada al-Sadr have been given three days to surrender their weapons and sign a pledge renouncing violence.

Iraqi Prime Minister Nouri al-Maliki issued the 72-hour deadline in the southern oil port city of Basra.

The ultimatum comes as the Shiite prime minister is in Basra to supervise a crackdown against the spiraling violence between militia factions vying for control of Iraq's second-largest city.

Iraq's leaders faced their gravest challenge in months as al-Sadr's followers battled government forces for control of Basra, fought U.S. and Iraqi troops in Baghdad and unleashed rockets on the Green Zone.

Armed Mahdi Army militiamen appeared on some Baghdad streets for the first time in more than six months, as al-Sadr's supporters announced a nationwide campaign of strikes and demonstrations to protest a government crackdown on their movement.

Merchants shuttered their shops in commercial districts in several Baghdad neighborhoods.

U.S. and Iraqi troops backed by helicopters fought Shiite gunmen in Baghdad's Sadr City district after the local office of al-Maliki's Dawa Party came under attack, the U.S. said. Residents of the area reported intermittent explosions and gunfire in the area late Tuesday.

An American soldier was killed in fighting Tuesday afternoon in Baghdad, the U.S. military said. No further details were released, and it was unclear whether Shiite militiamen were responsible.

Although all sides appeared reluctant to trigger a conflagration, Brig. Gen. Ed Cardon, assistant commander of the U.S. task force operating south of Baghdad, said the situation in the south was "very complicated" and "the potential for miscalculation is high."

The burgeoning crisis — part of an intense power struggle among Shiite political factions — has major implications for the United States. An escalation could unravel the cease-fire which al-Sadr proclaimed last August. A resumption of fighting by his militia could kill more U.S. soldiers and threaten — at least in the short run — the security gains Washington has hailed as a sign that Iraq is on the road to recovery.

The confrontation will also test the skill and resolve of Iraq's Shiite-led government in dealing with Shiite militias, with whom the national leadership had maintained close ties.

Underscoring the serious stakes at play, al-Maliki, a Shiite, remained in the southern city of Basra to command the security operation. Sweeps were launched at dawn to rid the city of militias and criminal gangs that ruled the streets even before the British handed over control to the Iraqis in December.

U.S. and Iraqi officials believe some factions of al-Sadr's movement maintain close ties with Iran, which provides them with weapons, money and training. Iran denies the allegation.

Basra, located near the Iranian border about 340 miles southeast of Baghdad, is the center of the country's vast oil industry. Stability in the city is essential if Iraq is to attract huge investments needed to restore its neglected oil fields and export facilities.

Throughout the day, the sounds of explosions and machine gunfire echoed through Basra's streets as Iraqi soldiers and police fought the Mahdi Army in at least four strategic neighborhoods.

A military spokesman said 40 people have been killed and 200 wounded in two days of fighting between Shiite militias and government forces in the southern city of Basra.

Associated Press Television News video showed smoke rising over Basra, and coalition jets prowling the skies while ambulances raced through the streets.

Iraqi police and soldiers prevented journalists from reaching the areas of heaviest fighting, and it was unclear which side had the upper hand by sundown.

Iraqi military spokesman Col. Karim al-Zaidi acknowledged that government troops were facing stiff resistance.

Residents of one neighborhood said Mahdi Army snipers were firing from rooftops. Others fired rocket-propelled grenades at the troops, then scurried away on motorcycles. Other residents said police fled their posts.

Residents spoke by telephone on condition of anonymity because of fear of reprisals, and their accounts could not be confirmed.

British troops remained at their base at the airport outside Basra and were not involved in the ground fighting Tuesday, according to the British Ministry of Defense. Air support was being provided, but a spokesman would not say if it was U.S. or British planes.

The British had given assurances that the Iraqis could handle security in the city when they withdrew last year.

In Baghdad, several salvos of rockets were fired at the U.S.-protected Green Zone, which houses the American and British embassies. There were no reports of casualties, but the blasts sent people scurrying for concrete bunkers.

Lawmakers from al-Sadr's movement announced that a civil disobedience campaign which began Monday in selected neighborhoods of the capital was being extended nationwide. The campaign was seen as an indication that the Sadrists want to assert their power without provoking a major showdown with the Americans, who inflicted massive casualties on the Mahdi Army during fighting in 2004.

Iraq's national security adviser, Mouwaffak al-Rubaie, was in contact with the Sadrist leadership in hopes of easing the crisis, said a top Sadrist official, Liwa Smeism.

Schools and shops were closed in many predominantly Shiite districts. "All shops are closed in my area except bakeries and vegetable stands," said Furat Ali, 35, a merchant in southwestern Baghdad.

Police also reported fighting between Iraqi security forces and Mahdi militiamen in the Shiite cities of Hillah and Kut, which lies on a major route between Baghdad and the Iranian border.

The showdown with al-Sadr has been brewing for months but has accelerated since parliament agreed in February to hold provincial elections by the fall. The U.S. had been pressing for new elections to give Sunnis, who boycotted the last provincial balloting three years ago, a chance for greater power.

Al-Sadr's followers have also been eager for elections, believing they can make significant gains in the oil-rich Shiite south at the expense of Shiite parties with close U.S. ties.

Sadrists have accused rival Shiite parties, which control Iraqi security forces, of engineering the arrests to prevent them from mounting an effective election campaign.

They also complain that few of their followers have been granted amnesty under a new law designed to free thousands held by the Iraqis and Americans.

"The police and army are being used for political goals, while they should be used for the benefits of all the Iraqi people," said Nassar al-Rubaei, leader of the Sadrist bloc in parliament. "If these violations continue, a huge popular eruption will take place that no power on Earth can stop."