Gunmen from a messianic Shiite cult attacked police and worshippers preparing Friday for a major Shiite holiday, prompting fierce clashes that left nearly 50 people dead in a major test for Iraqi security forces in oil-rich southern Iraq.

Carrying yellow flags or wearing yellow headbands to show their allegiance to the Soldiers of Heaven cult, the gunmen attacked police stations and opened fire randomly on civilians in Basra and Nasiriyah.

Last year, U.S. and Iraqi troops battled cult followers in fields outside the holy city of Najaf after determining that its members planned to disguise themselves as pilgrims and kill leading clerics.

Basra police chief Maj. Gen. Abdul-Jalil Khalaf said 30 militants and six security forces were killed, more than doubling the early toll. A police officer in Nasiriyah said at least 10 people were killed there.