Algerian President Abdelaziz Bouteflika has stepped down after 20 years in office and weeks of massive nationwide protests aimed at pushing him out of power.

The announcement followed a call from the powerful army chief for the ailing president, 82, to “immediately” take up his proposal to bow out while respecting the constitution.

The official APS news agency said that Bouteflika had notified the Constitutional Council of his decision to end his mandate.

There was no immediate word on who would take over.

Abdelaziz Bouteflika, pictured in 2008, has stepped down from power Credit: AP

Under the constitution, the president of the upper house, the Council of Nations, steps in as interim leader for a maximum of 90 days so that elections can be organised.

Army chief Ahmed Gaid Salah had earlier in the day convened a meeting of the top military hierarchy, making clear that the call for Bouteflika to step down had the backing of the military.

The Defence Ministry communique referred to Bouteflika’s entourage as a “gang” and said it had made “fraud, embezzlement and duplicity its vocation”.

He has rarely been seen in public since a 2013 stroke. His resignation caps six weeks of peaceful protest marches calling for him to make an exit.

It was preceded by calls for him to submit to Article 102 of the Constitution that would declare him unfit for office.

The Defence Ministry statement Tuesday appeared to be a final warning.

Bouteflika came to the presidency after its darkest period, the 1990s Islamic insurgency. After taking power in 1999, he managed to bring back stability to a country devastated by killings and distrust.

As president, age and illness took its toll, and corruption scandals dogged him and associates.

Bouteflika is accused of failing to create an economy that could offer enough jobs, despite the nation’s vast oil and gas wealth.

In a country where secrecy surrounds the leadership, it has never been clear whether Bouteflika was fully in charge or whether the powerful army was pulling the strings.