BAGHDAD  At least 21 people were killed Wednesday in Karbala when a bomb was detonated only miles from a sacred Shiite shrine during a week in which millions of pilgrims are converging on the holy city.

In addition to the fatalities, more than 100 people were wounded, according to local and national officials.

It was the second major bombing against Shiite pilgrims this week, and it underscored the helplessness of Iraq’s security forces to prevent attacks despite an imposing show of force.

Local officials said the attacker drove a motorcycle, pulling a cart laden with explosives, and detonated the bomb by remote control after parking in a crowded area. However, an official at the Interior Ministry said that it was a suicide bombing, with the attacker steering a minibus rigged with explosives into a crowd on the outskirts of the city.