Bangui - At least 20 people were killed over three days of fighting between soldiers and rebels in the Central African Republic, a local legislator said on Thursday.

Rebels from the Union for Peace in the Central African Republic (UPC), a splinter group of the mainly Muslim Seleka militia, had been attacking army positions in the northern town of Bambari since Monday, said local legislator Aubin Amadou.

On Thursday, the rebels continued to occupy public buildings including the gendarmerie, the police station, the prefecture and a local radio station, according to the legislator.

About 40,000 residents fled the town of 90,000 due to the clashes, while dozens of homes had been burned down and shops looted, Amadou said.

Medical aid organization Medecins Sans Frontieres said it had attended to 17 injured people since Monday.

The diamond-rich but poverty-stricken nation has been in crisis since late 2012, when violence broke out between Muslim and Christian rebel groups.

After a period of relative calm in 2016, fighting erupted again in early 2017 in various towns across the country.