A minute later, 11 people died and 27 were wounded when a second bomb went off next to a hotel in central Bouira, APS and the state-run national radio said. Both bombs were remote-controlled.
A security official in the Bouira area told The Associated Press news agency that nearly all the victims were civilians. He spoke on condition of anonymity because he was not allowed to discuss such matters with the media.
The military barracks was most damaged.
Abdellah Debbache, the Bouira correspondent of Algeria’s Liberte newspaper, told AP: “Parts of the walls have fallen off, the fence is destroyed, cars are buried under the rubble.”
Algerian news reports said the front facade of the barracks had been torn off and that several other buildings had been damaged.
Most victims from the second bomb had been travelling in a bus that passed in front of the hotel, APS said.
Hospital officials said they were workers from a construction company building a dam nearby at Koudiet-Acerdoun.
Bouira was cordoned off by police, and several additional roadblocks were set up in the region.
The attacks came a day after a bomber drove a car packed with explosives into the entrance of a police school killing at least 43 people and injuring 45 others.
Many of the dead were university graduates waiting outside to take an entry exam in the hope of joining the paramilitary police force.
No group has claimed responsibility for either attack.
Yassir Abdul Hai, an Algerian journalist specialising in security issues, told Al Jazeera that al-Qaeda is the prime suspect in these attacks, and has adopted a new strategy in targeting the military and police.
“Previous operations used to be random and to target civilians. However, these ones target military figures in particular,” he said.
“The meaning of these messages is reflected through these operations, and ultimately the availability of information about the movements of military leaders. Carrying our such operations and knowing the accurate timing of their movements is worrying.”