Algeria's President Abdelaziz Bouteflika has resigned, succumbing to a groundswell of public pressure after weeks of mass protests against his 20-year rule.
The ailing, 82-year-old leader announced he was standing down in a statement carried by state news agency APS, shortly after the army chief of staff demanded immediate action to remove him from office.
On Monday Bouteflika, in poor health and rarely seen in public since he suffered a stroke in 2013, had said he would quit before the end of his term on 28 April.
But chief of staff Lieutenant General Ahmed Gaed Salah said that statement had been issued by "unconstitutional and unauthorised parties", APS said.
"There is no more room to waste time... We decided clearly...to stand with the people so all their demands get fulfilled," Salah said after a meeting with senior officers.
Pressure had been building during the day with opposition groups demanding Bouteflika go immediately, while hundreds of students marched through the capital Algiers to demand the replacement of a political system widely seen as incapable of significant reform.
"Bouteflika's decision (to resign by the end of his term) will change nothing," Mustapha Bouchachi, a lawyer and protest leader, told Reuters earlier on Tuesday.
Bouteflika's resignation will put Abdelkader Bensalah, chairman of the upper house of parliament, in charge as caretaker president for 90 days until elections are held.
Bouchachi had suggested Bouteflika's nomination of a caretaker government was a move to perpetuate the current political system.
"What is important to us is that we do not accept the (new caretaker) government. Peaceful protests will continue."
A veteran of Algeria's war for independence, Bouteflika was first elected president in 1999 and established himself by ending a civil war with Islamist militants that killed an estimated 200,000 people.
But the country remains mired in corruption and, in a sign that the end for Bouteflika's rule had been approaching, several oligarchs close to his camp were banned from travelling abroad in the past few days, part of a crackdown against his allies.
"The gang has made big money illegally taking advantage of its closeness with decision-makers," Salah said, according to APS, referring to unnamed business people.
The protests have been driven by the country's youth and lawyers demanding the removal of a ruling elite seen by many as out of touch with ordinary Algerians and presiding over an economy riven by cronyism.