Guinea's president has survived an assassination attempt by gunmen who opened fire on his home, throwing into doubt the stability of the country's first democratically elected government.

President Alpha Condé was woken by the shooting, which erupted around his residence between 3am and 5am. A rocket-propelled grenade landed inside the compound, destroying part of it.

One of his bodyguards was killed and several others wounded, said François Louceny Fall, Condé's chief of staff. Condé, 73, addressed state radio saying his security detail had "heroically fought" until reinforcements arrived.

He called on the population to remain calm and said the attack would not derail the promises he made to voters seven months ago when he became the first democratically elected leader in Guinea's 52-year history.

Just hours later shooting broke out again near his home, and residents say they saw the red beret-wearing presidential guard take fighting positions.

"If your hand is in the hand of God, nothing can happen to you ... Our enemies can try everything, but they will not stop the march of the Guinean people," Condé said in his address. "Guinea is one country. We are united, for we cannot grow if we are not united. Let us not accept to be divided."

Soldiers fanned out across this capital city located on a peninsula jutting out into the Atlantic Ocean on Africa's western coast. They tied ropes between trees at intersections, and traffic was at a standstill as each car was stopped and drivers were told to open their trunks. Military helicopters circled overhead. Shops and schools were closed.

Tens of millions of dollars were invested by the international community to ensure last year's transparent vote, and a coup would be a major setback for the region, analysts say.

"It just shows the fragility of the country," said Guinea-based election expert Elizabeth Cote of the International Foundation for Election Systems, who worked for years overseeing voter registration and training of poll workers before last year's election. "It's hard to brand what just happened, but hopefully it can be a wake-up call," she said.

Political insiders say that Condé's relationship with the military is strained, and the ethnic tensions that were revealed by the vote are only getting worse.

Cellou Dalein Diallo, the Peul politician who lost to Condé, said in May that he was living abroad because he no longer felt safe at home. His house has been repeatedly visited by Malinke soldiers in what Diallo claims is an intimidation attempt.

Just last week, a group of Malinke farmers killed 1,200 head of cattle belonging to Peul herders after a dispute over land use.

"Military violence is something that deeply frightens us," said Sidya Toure, who came third in last year's vote. "We lived through this in 2008, and again in 2009. What it shows is that apparently there is a problem. There are things that remain unfinished."