President Joao Bernardo Vieira had ruled intermittently since 1980
Renegade soldiers have shot dead the president of the West African country of Guinea-Bissau, officials say.
The killing of Joao Bernardo Vieira is thought to have been a revenge attack, after the army chief of staff died in an explosion a few hours earlier.
The army denies there is a coup, and the capital Bissau is said to be quiet.
Guinea-Bissau is one of the world's poorest states. It has a history of coups and has become a major transit route for smuggling cocaine to Europe.
The cabinet announced seven days of national mourning for both leaders and launched a judicial inquiry into the deaths.
"President Vieira was killed by the army as he tried to flee his house, which was being attacked by a group of soldiers close to the chief of staff Tagme Na Waie, early this morning," military spokesman Zamora Induta told AFP news agency.
He accused Mr Vieira of being responsible for the death of the army chief of staff, with whom he had fallen out.
Braima Camara, a reporter from privately-owned Radio Pindiquiti in Bissau, told the BBC the president had been killed at his private house, not far from the presidential palace.
He said the president had been shot and stabbed in retaliation after he admitted giving the orders for Gen Tagme to be killed.
The president's house was largely destroyed in the assault and later looted by soldiers, he said.
He added that the military had taken the president's wife and family to the UN representative in Bissau.
JOAO BERNARDO VIEIRA
Electrician by trade
Key figure in struggle against Portuguese colonial rule
1980: Came to power in coup, as head of armed forces
1994: Won country's first multi-party elections
1999: Overthrown after sacking army chief
2005: Returned from asylum to win presidential election
Chief of staff Gen Tagme died after a blast late on Sunday that destroyed part of the military headquarters.
The army then ordered two private radio stations in the city to cease broadcasting.
Armed forces spokesman Samuel Fernandes told reporters at one station: "We are going to pursue the attackers and avenge ourselves".
But in a statement on state radio following Mr Vieira's death, the military insisted no coup was in progress.
The armed forces statement said the military would respect the constitutional order - in which the head of the parliament succeeds the president in the event of his death.
The national assembly speaker - Raimundo Pereira - has now taken over at the helm of a transitional government and must organise presidential elections within 60 days.
The president and army chief are said to have been at odds for months.
Renegade soldiers last November attacked the presidential palace with automatic weapons in a failed coup attempt.
Relations between Gen Tagme (above) and President Vieira had soured
The African Union, the European Union and former colonial ruler Portugal condemned the killing of 69-year-old Mr Vieira - nicknamed "Nino" - as did Mohamed Ibn Chambas from the regional economic bloc Ecowas.
"It's not only the assassination of a president or a chief of staff, it's the assassination of democracy," Mr Chambas told AFP.
Ecowas is due to hold an emergency summit about the crisis in Bissau on Tuesday, while the AU is reportedly arranging its own meeting over the situation.
Plagued by coups
The West and Central Africa head of the United Nations Office on Drugs and Crime said he did not think the killing had anything to do with the drug trade.
Antonio Mazzittelli told the BBC's Focus on Africa programme it was more "the result of an institutional and personal character crisis rather than anything else".
After last November's attack, the president was subsequently given his own 400-strong militia for protection.
In January, that militia was accused of trying to kill the head of the army and was then disbanded.
Some analysts suggested an ethnic dimension to the unrest.
President Vieira, from the minority Papel ethnic group, once accused officers from the majority Balanta community of plotting against him. Several were condemned to death and others to long prison sentences.
Guinea-Bissau has been plagued by coups and political unrest since it gained independence from Portugal in 1974.
President Vieira, just like the country's previous leaders, relied on the army to stay in power, and personal rifts made it a rocky relationship, the BBC's West Africa correspondent Will Ross says.
Guinea-Bissau is a major transit point for Latin American cocaine headed for Europe and some army officials are known to have become involved in the trade, our correspondent says.