At least 16 people have been killed after al-Shabab attacked a police station in the town of Baladweyne in central Somalia, blowing out the gates of the compound with a car bomb.

Abdi Mohamed Ali, a senior Somali army officer, told AFP on Tuesday that at least soldiers and civilians were among the dead, adding that there were some serious injuries.

He also said that four al-Shabab gunmen were also killed.

A spokesperson for the armed rebel group claimed responsibility for Tuesday's attack, saying that their fighters were now in "full control" of the police compound.

"Target of the attack is the apostate soldiers and Djibouti soldiers who were at the base. Our fighters are now in full control of the base," a spokesperson told Al Jazeera, refering to African Union forces who are part of the AMISOM force helping the Somali government to secure the country.

"We have killed many of them. Our fighters are also now in control of Madina hotel which is next to the base."

A police officer said on Tuesday that a large blast had taken place in the town, followed by an attack on police officers within the station.

"Armed militants went in and continued killing policemen," legislator Dahir Amin Jesow said.

The number of casualties in the raid was not immediately clear.

Baladweyne has been hit by a series of bombs and shootings claimed by al-Qaeda-linked al-Shabab fighters over the past few months.

Last month a suicide bomber attacked a restaurant in the town, killing 13 people.

In a statement released after Tuesday's attack, Somali President Hassan Mohamed lauded AMISOM's "brave role in stabilising Somalia" and condemned the "stupid attack".

"I say this was a stupid attack because our enemies need to understand that these attacks do nothing to advance their cause, however misguided. We are making great progress while our enemies are on the back foot and reduced to sporadic and self-defeating attacks with no regard to life."

Source: Al Jazeera and agencies