Police surprised a group of suspects trying to blow up an automatic teller machine in the eastern city of Salvador, sparking a shootout Friday that killed at least 13 of the would-be robbers, law enforcement officials said.

The Public Safety Department of Bahia state said the gang was setting up explosives next to an ATM when police arrived. All 16 gang members were wounded in the subsequent shootout and rushed to a nearby hospital, where 13 of them died. Two of the three surviving gunmen were listed in serious condition.

A police department press officer said no police officers were killed, but one was slightly wounded when a bullet grazed his head.