Rebel forces in the Central African Republic on Wednesday mounted their closest attack yet to the capital Bangui before being pushed back with the loss of a peacekeeper, the United Nations said.

The latest attack comes after rebels launched an offensive vowing to march on the capital ahead of last month's contested presidential election, in what the government has called an attempted coup.

In New York, UN Secretary-General Antonio Guterres and the UN Security Council strongly condemned Wednesday's attack and called on "all parties to bring an end to the violence and engage in constructive dialogue".

The statement followed a closed-door Security Council meeting on the situation in CAR at the request of former colonial power France.

UN peacekeepers have been helping push back rebel attacks
UN peacekeepers have been helping push back rebel attacks AFP / ALEXIS HUGUET

The UN's MINUSCA peacekeeping mission said Wednesday's attack was "repelled by Blue Helmets together with the Central African forces", adding that a Rwandan peacekeeper was killed.

The UN force's spokesman Abdoulaziz Fall said the attack occurred at a MINUSCA position 12 kilometres (seven miles) from the centre of Bangui.

"Several rebels were captured, and more than 10 were killed," he told AFP.

Earlier, Interior Minister Henri Wanzet Linguissara said armed groups opposed to President Faustin Archange Touadera carried out two simultaneous raids on Bangui's outskirts at dawn.

Several hundred trucks are stranded at Cameroon's border post of Garoua-Boulai because of poor security on the highway to Bangui
Several hundred trucks are stranded at Cameroon's border post of Garoua-Boulai because of poor security on the highway to Bangui AFP / Daniel Beloumou Olomo

The attacks took place nine and 12 kilometres from the capital, targeting two army brigades, the minister said.

"Thanks to the bravery of our forces and bilateral support, we were able to repel the assailants, who are now in disarray," he said.

Heavily armed Rwandan troops and Russian paramilitaries deployed last month to shore up Touadera's government under bilateral accords.

Market traders in the area, known as PK12 for its distance from Bangui, closed their stalls, and several armoured vehicles were sent in along with large numbers of Russian paramilitaries, government troops and UN soldiers.

Central African Republic
Central African Republic AFP / Sophie RAMIS

Scattered firing persisted in the late afternoon and aid workers said helicopters were attacking rebels holed up in the hills.

Many local people fled the area for Bangui, carrying suitcases and bags.

"I'm afraid," said a man who gave his name as Lais. "I don't know even where my family is."

In the capital itself, the streets were deserted, apart from a heavy military presence, an AFP reporter saw.

MINUSCA stepped up security in and around Bangui, while the government set a curfew that has been in place since January 7 to begin two hours earlier, at 6 pm, ending at 5 am as before.

A Russian-made MI-17 helicopter supporting Russian paramilitaries, Rwandan forces and government troops flies over Boali, the gateway to Bangui, on Sunday
A Russian-made MI-17 helicopter supporting Russian paramilitaries, Rwandan forces and government troops flies over Boali, the gateway to Bangui, on Sunday AFP / FLORENT VERGNES

In the run-up to elections on December 27, an anti-Touadera alliance of six armed groups called the Coalition of Patriots sought to advance on Bangui but were thwarted.

Their operation, according to Touadera, was an attempted coup fomented with the help of his predecessor Francois Bozize -- a charge that Bozize denies.

On January 4, Touadera was declared victor of the ballot, although the CAR's political opposition has cried foul.

The results account for only about half of registered voters, as hundreds of thousands were unable to cast their vote in areas held by rebels.

Militias claiming to represent ethnic or other groups control two-thirds of CAR's territory, raising income from mineral resources and "taxes" on traders and roadblocks.

Up until Wednesday, the rebels had carried out sporadic attacks in towns far from the capital and on the RN3 highway, the crucial supply line linking Bangui with neighbouring Cameroon.

Some analysts suggested the latest assaults could point to a change in tactics.

"What the rebels have understood is that the international community gauges the crisis in CAR on what happens in Bangui," Roland Marchal, a specialist at the Centre for International Research at Paris's Sciences-Po university, told AFP.

"This is why they are carrying out attacks on the immediate outskirts of Bangui -- not to take Bangui, which is strongly defended, but to demonstrate that Touadera no longer controls anything, or only very little."

Thierry Vircoulon of the French Institute of International Relations think tank said the rebels were waging a "war of nerves".

"They can conduct urban guerrilla warfare, and in the long term have hopes of taking Bangui."

CAR prosecutors have launched an investigation into Bozize, who came to power in a coup in 2003 before being overthrown in 2013, after which the country slid into sectarian conflict.

Thousands of people have died and more than a quarter of the population of 4.9 million have fled their homes. Of these, 675,000 are refugees in neighbouring countries.