Algerian President Abdelaziz Bouteflika bowed to popular demand Tuesday and resigned after over a month of protests over his decision to seek a fifth term, state news agency APS reported.

Bouteflika said in his resignation letter that his decision to leave office -- which came weeks before his term expires on April 28 -- was aimed at “preventing grave results” in the country, according to APS.

He said his intention was to “contribute to calming the souls and minds of the people so they can collectively take Algeria to the better future they aspire to”.

Bouteflika's decision came hours after Algerian Army Chief of Staff Lt. Gen. Ahmed Gaid Saleh demanded his immediate departure.

In a statement, Saleh reiterated the military’s commitment to the "implementation of a constitutional article on the vacancy of the presidential post," adding: "Our decision is clear and irreversible, as we stand with the people until their demands are fulfilled."

Saleh’s statement came a day after Bouteflika vowed to resign before his term officially expired later this month.

Saying Bouteflika's statement Monday was issued "from non-constitutional powers, not directly from him," Saleh said the “Algerian army will not accept extra-constitutional decisions."

In February, the country’s ruling National Liberation Front nominated the 82-year-old Bouteflika, who has ruled Algeria since 1999, to run for a fifth term in office. 

But on March 11, following weeks of protests against his presidential bid, Bouteflika abruptly postponed the polls -- originally slated for April 18 -- and formally withdrew his candidacy. 

Algerians have continued to stage demonstrations against the aged leader, who they accuse of unconstitutionally extending his fourth term in office.

Following Bouteflika’s resignation, hundreds of Algerians took to the streets to show their happiness over the decision.

They asked Saleh to arrest corrupt administrators and chanted slogans, including “The people and the army are brothers”.