Algerian strongman military chief Ahmed Gaid Salah, known for telling veteran leader Abdelaziz Bouteflika to resign, has died aged 79, official media say.
One of the last veterans of the 1954-62 independence war against France still in power, Gen Salah died of a heart attack.
Mr Bouteflika, who ruled since 1999, resigned in April after mass protests, leaving Gen Salah as de facto leader.
The opposition has been calling for the whole of the old regime to quit power.
Gen Salah has been replaced as acting army head by Gen Said Chengriha and three days of mourning have been announced.
Gen Salah played a major role in organising presidential elections on 11 December, which were boycotted by the opposition, saying they were necessary to avoid the country descending into chaos.
The election, fought between five candidates closely associated with Mr Bouteflika, was won by former civil servant Abdelmadjid Tebboune, who was dubbed as the "chosen one" on social media for being seen as close to the army chief.
What was General Salah's role?
Protests began in February after Mr Bouteflika announced that he would run for re-election.
It was the military chief who announced on 26 March that article 102 of the constitution - allowing the president's removal on grounds of ill health - should be applied, which resulted in Mr Bouteflika's resignation.
But protesters continued to call for the removal of those around the president, including Gen Salah himself.
As de facto leader, Gen Salah rejected opposition demands for deep reforms, the setting up of transitional institutions and the dismantling of the regime.
Ever since independence, the army has been the real centre of power in Algeria, arbitrating factional conflicts among politicians and business interests, making and unmaking presidents.
Mr Bouteflika himself was brought to the presidency in 1999 by a group of generals who had prosecuted a brutal war against militant Islamist insurgents since 1992.
Gen Salah, head of the army since 2004, was a central figure in this system.
A death likely to impact the president
Analysis by BBC Africa's Ahmed Rouaba
Abdelmadjid Tebboune was elected with the lowest turnout ever and will need the support of the new interim army chief of staff to take the country forward and overcome the biggest hurdle - popular protest.
In order to engage with the protesters, who still reject his election, Mr Tebboune has promised to carry out the necessary reforms to meet their demands including fighting corruption among the powerful and the elite.
Will he still be able to fulfil his promises and find dialogue with the protesters to get the whole country behind him?
The unexpected death of Gen Salah will certainly affect President Tebboune, who has lost a major supporter in his attempt to take the country forward and overcome the political crisis.
Who was General Salah?
- Born in 1940 in Batna region, 300km (186 miles) east of Algiers
- Joined National Liberation Army aged 17, and fought against French colonial forces
- Fought in the 1967 and 1973 Arab-Israeli wars
- After independence in 1962 attended Soviet military academy and rose through ranks
- Chief of land forces during civil war against Islamist insurgents in 1990s