Algeria‘s long-serving president Abdelaziz Bouteflika submitted his resignation late Tuesday, ending two decades of rule following weeks of mass protests that prompted key allies to turn against him.

The ailing 82-year-old leader stood down shortly after the army chief of staff demanded immediate action to remove him from office, the official Algerian Press Service reported.

“There is no more room to waste time,” APS quoted Lieutenant General Ahmed Gaed Salah, once a key pillar of Mr Boutelflika’s rule, as saying.

The resignation grants a key demand to hundreds of thousands of Algerians marching in the streets for weeks demanding political reform and transparency. Many Algerians wildly celebrated the departure of the man who guided the country from a brutal 1990s civil war to a period of relative stability that was rife with corruption and stagnancy.

But Mr Bouteflika’s departure also throws the country into a fresh state of uncertainty. Under Algeria’s charter, a constitutional council now sets the course for a transition period and fresh elections. Algeria’s constitution denotes the head of the upper house of parliament, Mr Bouteflika’s ally Abdelkader Bensalah, as interim leader for a maximum of 90 days as elections are organised.

Algeria’s powerful military has repeatedly intervened in politics over the decades, including the crushing of the country’s nascent democratic changes in the early 1990s. Analysts say the armed forces are sure to attempt to manipulate the process. Meanwhile protesters are determined to continue to march, in what appears to be a generational rebellion against the elderly cadres who helped liberate the country from French rule in 1962 but continue to remain in power. Nationwide mass protests scheduled for Friday will continue, activists said.

In downtown Algiers, protesters brandished placards reading: “See you Friday,” said one witness. “They know Bouteflika is the tip of the iceberg. The demand from day one was, ‘Get out, all of you.’”

Scholar Mohamed Affan explains how Algerian military faces an uprising

That sets up a potentially perilous confrontation between protesters demanding transparency and reform and military officials and their private and public sector allies eager to maintain their grip on power.

Mr Bouteflika has not publicly spoken and has been wheelchair-bound since a stroke in 2013. Many Algerians suspect he’s been serving as a front for shadowy powers that include business leaders and military and intelligence officials.

On Monday, Mr Bouteflika, who was in power for 20 years, said in a statement attributed to him he would quit before the end of his term on 28 April.

But opposition parties rejected this as insufficient, while hundreds of students marched through the capital Algiers to demand the replacement of a political system widely seen as incapable of significant reform.

Algerians protest against President Bouteflika Show all 14 1 /14 Algerians protest against President Bouteflika Algerians protest against President Bouteflika Protests against President Bouteflika in Algiers on March 15 Reuters Algerians protest against President Bouteflika Protesters march in Algiers to demand the resignation of President Bouteflika on March 15 Reuters Algerians protest against President Bouteflika Protesters carrying the national flag protest against President Boueflika on the Republique Plaza on March 17 AP Algerians protest against President Bouteflika Algerians march during a protest in Algiers on March 15 AP Algerians protest against President Bouteflika Students protest in Algiers on March 19 Reuters Algerians protest against President Bouteflika Protesters hang national flags atop a building in Algiers on March 15 Reuters Algerians protest against President Bouteflika Algerian doctors protest against President Bouteflika on March 19 in Algiers EPA Algerians protest against President Bouteflika Algerians demand the resignation of President Bouteflika in a protest on March 15 in Algiers AFP/Getty Algerians protest against President Bouteflika A woman holds a placard with the photo of President Bouteflika during a protest on March 15 in Algiers AP Algerians protest against President Bouteflika Algerians demand the resignation of President Bouteflika in a protest on March 15 in Algiers AFP/Getty Algerians protest against President Bouteflika Algerian doctors march against President Bouteflika on March 19 in Algiers EPA Algerians protest against President Bouteflika Algerians take part in a demonstration against President Bouteflika on March 19 in Algiers AFP/Getty Algerians protest against President Bouteflika Algerian doctors protest against President Bouteflika on March 19 in Algiers AFP/Getty Algerians protest against President Bouteflika Employees of the Algerian Ministry of Vocational Education and Training protest against President Bouteflika in Algiers on March 18 EPA

The announcement that he would step down by the end of his fourth term in office failed to quell protesters, who said it did not go far enough in bringing dramatic change to Algeria’s opaque power networks.

Mr Bouteflika’s office had said on Monday that the president would take “important steps” to ensure the continuity of the country’s institutions, fuelling fears that his entourage was seeking to cement its hold on power.

But Lt Gen Gaid Salah later presided over a meeting with senior army officials to discuss implementing a procedure in the constitution for removing a sitting president.

“Our decision is clear and irrevocable. We will support the people until their demands are fully and completely satisfied,” he said in statement.

Mr Bouteflika had originally planned to seek a fifth term but has faced intensifying protests since mid-February..