BAGHDAD — Clad in combat gear and marching in military formation, thousands of Shiite Muslim militiamen on Saturday vowed to defend Iraq’s capital from a Sunni insurgent movement that seized two more towns from government forces.

Followers of radical Shiite cleric Muqtada al-Sadr heeded his call to demonstrate in the eastern Baghdad neighborhood of Sadr City and in towns across southern Iraq’s Shiite heartland in a fearsome show of strength by the Mahdi Army, the paramilitary group that fiercely battled U.S. forces during last decade’s civil war.

Officially disbanded, the Mahdi Army still counts thousands of members. Their reappearance with machine guns, assault rifles and other heavy weaponry before throngs of supporters illustrated the failure of the U.S.-trained Iraqi army, which has been routed from much of northern and western Iraq in recent weeks by a sophisticated Sunni Muslim insurgent group, the Islamic State of Iraq and Syria, or ISIS.

Although the Shiite fighters said they would go to battle only on the orders of government forces, heeding the instructions of senior clerics, the well-organized parades were a reminder of the sectarian bloodletting of the civil war, in which Sunnis and Shiites turned on each other with the firepower of militias such as the Mahdi Army.

U.S. officials say the Shiite call to arms can bolster the weakened Iraqi military, but warn that if the fighters are not kept under control they could again engage in sectarian violence.

Some clad in black, others carrying rockets on their shoulders,al-Sadr’s followers said they would protect religious sites from ISIS, which has laid waste to churches and shrines in towns it controls and pledged to march into Baghdad, the capital, and farther south to destroy some of the holiest sites in Shiite Islam.

“The goal here is to terrify the enemy and to show them that we are still here,” said Mehdi Hassan, 39, who marched in the parade. “The army is weak, but we can support them.”

After ISIS fighters this month staged a rapid takeover of several towns, including the strategic northern city of Mosul, Iraqi security forces and volunteers bolstered defenses in Baghdad. U.S. and Iraqi officials now believe the insurgents are unlikely to take over the capital, although their ability to stage attacks has improved because of recent battlefield successes.

A roadside bomb exploded in Sadr City soon after the parade ended, killing one person and wounding five others, according to residents.

Security officials say that more than 60,000 volunteers, mostly Shiites, have volunteered to help Iraqi forces in Baghdad alone and that, for now, their help is welcome.

“We can receive them as individuals, not as a group,” said Saad Maan, spokesman for the Iraqi army’s Baghdad command. Al-Sadr “has called on them to protect religious places, and we agree with that strongly,” he said.

The military-style parade, along with similar demonstrations in several southern cities, came as ISIS fighters captured the town of Rawah in Anbar province, about 175 miles northwest of Baghdad and 50 miles from the Syrian border.

A day earlier, according to Iraqi media reports, ISIS fighters killed 30 Iraqi soldiers before winning control of Qaim, a border crossing into Syria, in a fierce battle that laid bare the insurgents’ ability to wear down Iraqi forces.

During three days of clashes, ISIS bombarded an Iraqi army brigade with heavy artillery every morning before mounting a ground assault from several directions, according to officials briefed on the fighting. The Iraqi brigade finally withdrew late Friday after its Sunni commander was killed.

ISIS militants already control vast swaths of Anbar and have virtual free rein along the Iraqi-Syrian border. Gaining control of the border crossing could make it easier for the militants to move heavy weaponry between the two countries.