Open this photo in gallery The resignation of Abdelaziz Bouteflika, seen here in November, 2017, possibly signals the start of a political revolution that could see Algeria form a democracy. RYAD KRAMDI/AFP/Getty Images

Algerian President and dictator Abdelaziz Bouteflika announced the end of his 20-year rule and a delay to the planned spring elections after weeks of largely peaceful mass protests against his regime threatened to turn violent and destabilize the oil-rich North African country.

The resignation on Monday of Mr. Bouteflika, who is 82, uses a wheelchair and has rarely been seen in public since suffering a stroke in 2013, possibly signals the start of a political revolution that could see Algeria form a democracy. He agreed to step down the day after he returned from Switzerland, where he had been receiving medical treatment.

Until Monday, he had planned to seek a fifth term as president, even though he was incapacitated and highly unpopular among young Algerians. He announced his resignation in a long letter to the Algerian people, in which he praised the peaceful nature of the protests. The letter was published shortly after more than 1,000 judges said they would refuse to oversee the presidential election if he were a candidate.

Mr. Bouteflika was the only North African leader to survive the Arab Spring revolutions that started in Tunisia in late 2010 and quickly spread to Libya and Egypt. Tunisian dictator Zine El Abidine Ben Ali fled the country in January, 2011, after which Tunisia was able to form the first North African democracy. About the same time, Egyptian strongman Hosni Mubarak was ousted. In late 2011, Libyan dictator Moammar Gadhafi was killed during Libya’s brutal civil war, which has yet to end.

The news that he would not seek re-election triggered celebrations in Algiers, the capital, and other cities. “There is jubilation in the streets,” said Amor Shabbi, the Algerian journalist from Constantine who is managing editor of the Atlas Times news site.

Open this photo in gallery People celebrate on the streets after President Abdelaziz Bouteflika announced he will not run for a fifth term, in Algiers, Algeria March 11, 2019. ZOHRA BENSEMRA/Reuters

Mr. Bouteflika’s resignation did not come entirely as a surprise, especially since the Algerian military recently expressed solidarity with the Algerian people.

“The fifth mandate of Bouteflika is dead,” Yahia Zoubir, the Algerian director of research in geopolitics at the Kedge Business school in Marseilles, France, said in an interview. “Everyone in Algeria is aware that this is a big turning point for the country. What is amazing is that this happened peacefully.”

Story continues below advertisement

A government reshuffle would take place soon, the office of the presidency said, followed by a national conference that will set a new political agenda by the end of the year. The date for a fresh election has not been set, though it is likely to happen in 2020, after the constitution is overhauled. “This new system and new republic will be in the hands of a new generation of Algerians,” Mr. Bouteflika said in his letter.

The Algerian Prime Minister, Ahmed Ouyahia, also resigned and was replaced by Noureddine Bedoui, who had been Interior Minister. Mr. Bouteflika’s diplomatic adviser, Ramtane Lamamra, was appointed deputy Prime Minister.

Mr. Zoubir said that Mr. Bouteflika’s decision not to seek another term was not all good news, since it appears he will remain in office until the new president is elected. “This is the scenario that the population didn’t want,” he said.

Algerian elections are not considered democratic, as Mr. Bouteflika has quashed potential rivals and had constitutional term limits changed to allow him to serve more than two terms.

Open this photo in gallery People take part in a protest demanding immediate political change in Algiers, Algeria, on March 12, 2019. ZOHRA BENSEMRA/Reuters

The Algerian protests began on Feb. 22, after young Algerians learned that Mr. Bouteflika intended to seek a fifth term as president in elections that had been scheduled for April 18. Millions of Algerians, especially the younger generation, were angry about their high jobless rate, which is more than double the national average of about 12 per cent, and lack of political voice. They opposed the corruption and entrenched power of Mr. Bouteflika, his political cronies in the National Liberation Front (FLN) party and the powerful military generals who supported them.

“The young people want a revolution, but a peaceful one,” said Mr. Sabbi, the Algerian journalist. “They want change that will give them hope for the future, to have better work opportunities. Some say they want democracy, like Tunisia. Others just want the regime removed, but don’t say what they want to replace it with."

Story continues below advertisement

The protests since last month proved relentless. Algerian sociologist Fatma Oussedik reportedly estimated that three million Algerians took to the streets (Algeria’s population is about 42 million). There were clashes, with local media saying that more than 100 protesters and a similar number of police were injured in the protests.

Late last week, mass violence seemed a possibility after protesters set the Museum of Antiquities on fire in Algiers. Some of the artifacts were looted, the culture ministry said.

But mass violence never broke out. Mr. Zoubir and Mr. Shabbi said that all Algerians feared a repeat of the civil war in the 1990s, which killed an estimated 200,000 people. The war pitted the military-backed government against the Armed Islamic Group of Algeria, known as the GIA, and other insurgent groups. The GIA exported its terrorism to France, Algeria’s colonial ruler until Algeria’s war of independence ended in 1962, staging several attacks in Paris.

Mr. Bouteflika was elected in 1999, at the end of the civil war, and tolerated no threats to his regime.