By Gerauds Wilfried Obangome

LIBREVILLE (Reuters) - Hundreds of soldiers and police officers were deployed in Gabon's capital Libreville on Friday to keep order after two days of post-election riots that threatened the half-century grip President Ali Bongo's family has held on power.

Violence erupted across the Central African nation on Wednesday with the announcement of a slim victory for Bongo, who was first elected in 2009 on the death of his father Omar, Gabon's president for 42 years.

Five people died in the unrest, Bongo's spokesman Alain-Claude Bilie By Nze said on Friday, and up to 1,100 arrests had been made by Thursday, according to the interior minister.

Bongo's chief rival Jean Ping said he won the vote, claiming the result was rigged, and has called upon the international community to intervene.

More than two dozen of his supporters, including a former vice-president, remained inside his campaign headquarters surrounded by security forces.

Some shops in Libreville's city center were open on Friday and traffic slowly began to pick up. But locals feared the violence, which former colonial power France and others in the West had condemned, might erupt again.

"It's a shame," said Paul Ndzembi, 57, part of a small group discussing events on a street in the city center. "We're afraid the situation will get worse."

The Internet was still down on Friday, a measure taken to prevent the opposition from using social media to organize further protests, a government source said. According to Libreville residents, text messages were also blocked.

The French and U.S. embassies in Libreville advised their citizens to remain at home.

Bongo benefited from a patronage system lubricated by oil money ahead of the vote in the major crude producer. But falling prices and production - dominated by Total and Shell - have led to budget cuts in a country where many citizens have not enjoyed the fruits of oil wealth.

Television stations, supermarkets, shops, and homes were looted in Libreville on Wednesday and Thursday and unrest also broke out in other cities and provinces.

The interior of the assembly hall at the parliament, set on fire by demonstrators on Wednesday, was completely gutted with seats and tables reduced to cinders, a Reuters witness said.

"I'm sad for my country because such things should never happen," National Assembly President Richard Auguste Onouviet said as he surveyed the damage at the parliament building.

INTERVENTION "DISRESPECTFUL"

Soldiers, deployed throughout Libreville on Thursday to reinforce the police, were positioned at crossroads on Friday and the elite Republican Guard ensured security near the presidential palace. Riot police were also in evidence.

A group of Ping's supporters remained inside his headquarters on Friday, nearly two days after the opposition leader said the building came under attack by soldiers, killing two people. Authorities have acknowledged five deaths in the two days of violence without giving details.

Ping's spokesman Jean Gaspard Ntoutoume Ayisaid said the group included former Vice-President Didjob Divungi Di Ndinge.

French Foreign Minister Jean-Marc Ayrault demanded on Friday that authorities release opposition members and said it was working with partners to find a quick solution to the crisis.

Bongo's spokesman Bilie By Nze told Paris-based France 24 television that the building had been surrounded because the security forces came under attack from inside.

"Security officers were shot at from this HQ. That is a fact. There were grenades," he said.

Ping has denied his supporters were armed.

France, the United States and the European Union have urged the authorities to release individual polling station results, a request Bongo's spokesman rejected on Thursday.

Interviewed on Friday on France 2 television, Ayrault repeated the call for more transparency but ruled out intervening in Gabon, home to 14,000 French citizens.

"We are Africa's partners but we do not want in any case to intervene in countries' internal affairs. That would be disrespectful of Africans," he said.

France has maintained a permanent military base in Gabon since independence in 1960 and 450 troops are stationed there to help contribute to regional stability, according to the French defense ministry.

The French military intervened in the Ivory Coast in 2011 under a U.N. mandate to help oust then-president Laurent Gbagbo after he refused to accept his defeat in a disputed election.

More recently it has intervened in Libya, Mali and Central African Republic. French soldiers are also carrying out an anti-terrorist operation across West Africa's Sahel region.

During more than four decades in power, Omar Bongo cultivated close relations with a succession of French presidents. However, Ali Bongo's ties to Paris have been more tenuous.

Gabon recalled its ambassador to Paris in January after France's Prime Minister Manuel Valls appeared to question the legitimacy of Bongo's 2009 election. Judicial authorities seized several Bongo family properties in France in April in the context of a corruption investigation.

Ping, a former diplomat and African Union Commission chairman, is a lifelong insider to Gabonese politics who fathered two children with Omar Bongo's daughter, Pascaline.

(Additional reporting by Marine Pennetier in Paris and Joe Bavier in Abidjan; Writing by Joe Bavier; Editing by Louise Ireland)