Algeria's ailing President Abdelaziz Bouteflika has pulled out of the country's upcoming presidential election and postponed the vote.
The 82-year-old returned to Algeria yesterday after medical treatment in Switzerland.
He had a stroke in 2013 and has rarely been seen in public but had been planning to run for a fifth presidential term.
That led thousands of Algerians to take to the streets in protest, and more than 1000 judges said they would refuse to oversee the election if Mr Bouteflika insisted on running. Clerics said they would not accept government orders about what to preach.
The presidency said the election, previously set for April, would now be postponed but it did not set a new date. A new constitution would be submitted to the public for a referendum.
Prime Minister Ahmed Ouyahia resigned and Interior Minister Noureddine Bedoui, who is not known as a member of Bouteflika's inner circle, was named as the new prime minister. Ramtane Lamamra, a diplomatic advisor to Bouteflika, was named deputy prime minister.
After the announcement, a crowd of demonstrators took to the streets waving a huge Algerian flag. Hundreds of people, young and old, joined the throng, jumping 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.
Mr Bouteflika also met his army chief of staff, Army Chief of Staff Lieutenant General Gaed Salah.
The demonstrations have been the biggest in Algeria since an election was annulled by a military coup in 1991, triggering a decade of civil war against Islamists in which 200,000 people were killed.
Mr Bouteflika oversaw the end of the war but his rule saw power 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.