Heavily armed attackers have launched co-ordinated assaults on several army barracks in Burundi.
An army spokesman said in a statement that 12 insurgents had been killed and another 20 arrested.
Witnesses described hearing gunfire and explosions for several hours, in Musaga in the south and Ngagara in the north.
The incident is the worst violence since an attempted coup in May, sparked by President Pierre Nkurunziza's third-term bid.
UN officials have recently accused both government and opposition figures of stirring up ethnic tension between Hutus and Tutsis, amid fears of a return to genocide.
Earlier reports had said up to five soldiers had been killed, but an army spokesman now says five soldiers were wounded in the attacks.
Residents of the capital, Bujumbura, have taken cover at home and are too frightened to go to work or send their children to school, reports the BBC's Prime Ndikumagenge from the city.
The attacks are the first on military targets since unrest started in April, he says.
Airlines including Kenya Airways and RwandAir have cancelled flights to Bujumbura due to a lack of airport personnel, though it is not clear if the airport has been officially closed.
The neighbourhoods where the attacks occurred are seen as opposition strongholds, correspondents say.
Analysis: Prime Ndikumagenge, BBC Africa, Bujumbura
The attacks are the first on military bases and signal a change in tactics from insurgents in the country.
Even during the attempted coup in May, military bases remained untouched.
There has been a gradual escalation in the violence in Bujumbura since May, with people initially showing dissent through street protests.
But after the government clamped down on the protests, it gradually evolved into an armed insurgency.
Grenades have been launched at police patrols, but not the military - until now.
No-one has claimed responsibility and it remains unclear who is behind the insurgency.
The military previously acknowledged that a number of soldiers have deserted the army and there are suspicions that these soldiers might have joined the insurgents.
The latest attacks look like a further escalation in a situation that has been prevailing for more than six months.
And no immediate solutions seem to be at hand.
It is not clear who is behind the attacks but a military spokesperson said insurgents wanted to take weapons before freeing prisoners.
A presidential adviser, Willy Nyamitwe, said the insurgents had failed, describing them as Sindjuma, meaning "I am not a slave".
Witnesses say that artillery fire was heard during the attacks on an army base in Ngarara and the ISCAM Higher Institute of Military Training in Musaga, AFP reports.
An army camp known as BASE, near ISCAM, was also attacked, Reuters reported, citing a soldier.
"After more than two hours of clashes, the army repulsed the southern attack, while virtually all the attackers were killed in the Ngagara base," a senior army officer told AFP.
Security forces are conducting aggressive search operations following the attacks, reports SOS Medias Burundi, an underground group of independent journalists.
Mr Nkurunziza won a disputed election in July.
At least 240 people have been killed since April. More than 200,000 people have fled to neighbouring countries, the UN says.
In recent months, there have been daily killings of both opposition activists and Nkurunziza supporters.
At least seven people were killed earlier this week, six by men wearing police uniforms.
Mr Nkurunziza is a former leader of a Hutu rebel group, fighting a Tutsi-dominated army.
He has been president since a 2005 peace deal.
This year's violence has not been along ethnic lines, however there are fears it could take that dimension.
Timeline - Burundi crisis
April 2015 - Protests erupt after President Pierre Nkurunziza announces he will seek a third term in office.
May 2015 - Constitutional court rules in favour of Mr Nkurunziza, amid reports of judges being intimidated. Tens of thousands flee violence amid protests.
May 2015 - Army officers launch a coup attempt, which fails.
July 2015 - Elections are held, with Mr Nkurunziza re-elected. The polls are disputed, with opposition leader Agathon Rwasa describing them as a "joke".
November 2015 - Burundi government gives those opposing President Nkurunziza's third term five days to surrender their weapons ahead of a promised crackdown.
November 2015 - UN warns it is less equipped to deal with violence in Burundi than it was for the Rwandan genocide