ALGIERS (Reuters) - Algerian President Abdelaziz Bouteflika abandoned his bid for a fifth term in power on Monday, bowing to weeks of mass demonstrations against his 20-year rule by people demanding a new era of politics in a country dominated by an old guard.

The veteran revolutionary also postponed an election that had been set for April, and promised social and economic reform.

Bouteflika’s announcement brought crowds back onto the streets in celebration on Monday evening. Hundreds of people, young and old, some draped in the national flag, jumped up and down with excitement. Cars beeped their horns in approval.

“Our protests have borne fruit! We defeated the supporters of the fifth term!” said taxi-driver Mohamed Kaci, 50.

However, Bouteflika stopped short of immediately stepping down and will remain in power for some time yet, pending a national conference on political change.

Tens of thousands of people from all social classes had demonstrated almost daily against his plan to run for re-election, rejecting a political system dominated for nearly 60 years by veterans of the independence war against France.

Bouteflika, 82, has ruled for 20 years but has rarely been seen in public since suffering a stroke in 2013.

His opponents said they did not believe he was in a fit state to run the country, an OPEC oil producer, and suspected he was being kept in place to protect the grip of the military and business elite.

In a series of announcements on Monday evening, the presidency said the election, previously set for April, would be postponed. A new constitution would be submitted to the public for a referendum.

Slideshow ( 18 images )

Bouteflika said his last duty would be to contribute to the founding of a new system that will be in “the hands of a new generation of Algerians”.

An “inclusive and independent” national conference will oversee the transition, drafting a new constitution and setting the date for elections.

The conference should finish its work by the end of 2019, with elections to follow, he said in a statement. The conference will be headed by an “independent, consensual and experienced national figure”.

Prime Minister Ahmed Ouyahia resigned and Interior Minister Noureddine Bedoui, not known as a member of Bouteflika’s inner circle, replaced him. Ramtane Lamamra, a diplomatic advisor to Bouteflika, was named deputy prime minister.

Bouteflika met Army Chief of Staff Lieutenant General Gaed Salah and veteran Algerian diplomat Lakhdar Brahimi, the kind of widely respected figure the military might look to as a guarantor of stability.

“The voice of the people has been heard,” Brahimi, a former foreign minister and U.N. special envoy, said on state television after meeting Bouteflika.

“Young people who took to the streets acted responsibly and gave a good image of the country. We must turn this crisis into a constructive process.”

Political sources said the military would almost certainly play a leading role in the transition process, and was assessing three or four civilians who could be eligible to become leaders.

Slideshow ( 18 images )

The army will likely rely on respected figures like Brahimi, and old friend of Bouteflika, to mediate.

The protests have mostly been peaceful and Bouteflika’s announcement should defuse the potential for a bloody showdown with security forces, as has been the case in several other Arab nations facing political upheaval in recent years.

Former colonial ruler France welcomed Bouteflika’s decision.

“France expresses its hope that a new dynamic that responds to the aspirations of the Algerian people can get under way quickly,” Foreign Minister Jean-Yves Le Drian said.

INERTIA SHATTERED

“We have won the battle. This will be a sleepless night,” said 25-year-old Abdelghani Hachi. Nearby, other young Algerians made V-for-victory signs.

Some of those celebrating on the streets struck a note of caution, saying they wanted a complete overhaul of the leadership which has offered few opportunities to young Algerians. More than a quarter of Algerians under 30 are unemployed.

Bouteflika, who returned to Algeria on Sunday after medical treatment in Switzerland, has watched one long-time ally after another join the demonstrations calling on him to step down.

More than 1,000 judges said on Monday they would refuse to oversee the election if Bouteflika stood. Clerics said they would not accept government orders about what to preach.

The protests have shattered years of political inertia and unsettled Algeria’s opaque but powerful security establishment.

The demonstrations have been the biggest in Algeria since an election was annulled by the military in 1991, triggering a decade of civil war against Islamists in which 200,000 people were killed.

Bouteflika oversaw the end of the conflict but under his rule power was concentrated in the hands of a secretive military-based establishment known to Algerians as “le pouvoir” -- the powers-that-be.

The security forces have been mostly restrained during the demonstrations, a signal of the establishment’s eroding willingness to keep the president in power through force.