Algeria’s powerful army chief Ahmed Gaid Salah has died. He was 79.

His death comes at a time of bitter political divisions over the military’s dominant role in the large energy exporter.

Gaid Salah died on Monday morning in the military hospital in Algiers after a heart attack, state radio and state news agency APS reported.

Gen Gaid Salah, 79, became the nation’s most powerful figure following the resignation of Algeria’s last president, Abdelaziz Bouteflika, in April. He was also reportedly close to the country’s new leader, Abdelmadjid Tebboune.

Africa’s largest country has been riven by mass protests since February, demanding a wholesale change in the ruling elite, including that the army steps back from politics.

Gaid Salah was seen as the main power player in Algeria .

He was present at the inauguration of the country’s new president only four days ago. He had suffered heart problems in the past, Algerian media reported, but his death came as a shock to most Algerians.

National radio stopped regular programming to broadcast readings from the Quran and classical Arabic music, while state television aired extracts of Gen Gaid Salah’s many speeches, one after the other.

The president declared three days of national mourning, while the army declared a week-long grieving period. Local media reported student groups planned to call off protests on Tuesday.

Gen Gaid Salah was born in 1940 in the Batna region, nearly 300 kilometres south-west of Algiers, and served the Algerian army for over six decades after joining during Algeria's fightback against French colonial forces in the late 1950s.

He commanded several regions before becoming chief of Algeria's land forces at the height of a decade-long civil war pitting the regime against Islamist insurgents.

After swiftly climbing the ranks, he was appointed chief of staff of the army by Mr Bouteflika in 2004, a position he maintained until his death, despite Mr Bouteflika's resignation .

Gen Gaid Salah is being replaced temporarily by another high-ranking general, Said Chengriha, state radio reported.

Gaid Salah also served as vice-minister of defence in the government. His decision to back protesters demanding the resignation of Mr Bouteflika earlier this year was pivotal. He was also behind the decision to hold new elections earlier this month.

But protesters later turned against Gaid Salah, demanding instead a wholesale makeover of Algeria’s political structure.

It was not immediately clear whether Gaid Salah’s death would make Tebboune’s job of reconciling the divided nation easier, or fuel the Hirak pro-democracy movement. Some activists from the peaceful movement continued to criticize Gaid Salah after his death, while other commentators praised him for ensuring that Algeria’s 10 months of political turmoil this year did not lead to violence.