Libreville (AFP) - A student was killed in clashes at an opposition rally in Gabon's capital, where police fired tear gas to disperse protesters demanding the resignation of President Ali Bongo Ondimba.

The opposition claimed three people had died and hundreds were injured in the violence, though there was no official confirmation of those figures.

At least 20 people were arrested in scuffles between police and demonstrators, an AFP journalist saw.

Public prosecutor Sidonie Flore Ouwe, who told reporters shops "were ransacked" and cars set on fire in the unrest, confirmed that a 30-year-old male student was killed in the clashes.

He succumbed to a throat injury likely caused by "a sharp object," added coroner Liliane Flore Pemba.

Security forces were out in large numbers Saturday to prevent hundreds of demonstrators from gathering at Libreville's Rio Intersection for a rally that had been outlawed by the interior ministry the day before.

"Ali, get out! 50 years is too long!" the crowd chanted.

President Ondimba took office after the 2009 death of his father Omar, who had been in power since 1967.

The police presence and heavy rainfall earlier in the day had already dispersed the bulk of the crowd, when clashes erupted with pockets of demonstrators.

Among those who were tear gassed were several leading opposition figures, including former African Union Commission chairman Jean Ping and ex-premier Jean Eyeghe Ndong.

Some demonstrators responded by throwing stones and bottles at the security forces. Others burned tyres and set fire to at least one vehicle, sending large plumes of black smoke into the sky.

"We came to march peacefully to say we are fed up of the country being looted, that's all, but they are treating us like dogs," said Jonas, one of the protesters.

The opposition took to Twitter to condemn the clashes.

"Three dead and hundreds injured. Peaceful rally brutally repressed," Ping wrote.

Ahead of the demo the United Nations' special representative for central Africa, Abdoulaye Bathily, had urged the government and the opposition to commit to dialogue to prevent "a deep crisis" in Gabon.

The political climate in the western African country, a former French colony, has worsened recently with the publication of a book by journalist Pierre Pean, which accuses the president of having falsified his birth certificate and diplomas.

In November, the opposition filed a complaint against the president but it was thrown out this week by prosecutors.