Mr Bouteflika, who has been in power for 20 years, had already dropped plans to seek a fifth term as opposition to his rule grew.

The powerful Algerian army had called for the 82-year-old to be declared incapable of carrying out his duties.

Protesters have vowed to continue piling on pressure until the entire government is ousted.

The BBC's Mohamed Arezki Himeur in Algiers says there were huge celebrations in the city, with people shouting, waving the national flag and honking their car horns all night.

He says the protesters do not only want Mr Bouteflika to go, but the whole system, in particular the government which was only appointed last weekend.

"This is just a little victory - the biggest is still to come," one protester said.

Mr Bouteflika, who has been ill since he suffered a stroke six years ago, has avoided public events ever since.

However, he made a rare appearance on state TV to relinquish power hours after military chief Lt Gen Ahmed Gaed Salah called on him to leave office immediately.

One man, Selmaoui Seddik, told Reuters: "God willing, we will have a 100% democratic transition, this is very important. We need to remove the whole previous regime and that is the hardest thing."

However, one protest leader, Mustapha Bouchachi, said before the announcement that any decision by Mr Bouteflika to quit would still change nothing and that the protests would continue.

News of the resignation came in a statement carried on state news agency APS.

"The president of the republic, Abdelaziz Bouteflika, has officially notified the president of the constitutional council of his decision to end his mandate as president of the republic," it said.

State TV then reported that this would be with immediate effect.

According to the constitution, the Senate speaker should take over as interim head of state until fresh elections are held.

How did it come about?

Pressure had been building since February, when the first demonstrations were sparked by Mr Bouteflika's announcement that he would be standing for a fifth term.

Tens of thousands protested across the country on 1 March. Mr Bouteflika's promise not to serve out a fifth term if re-elected, along with a change of prime minister, failed to quell the discontent.

Leaders of the protests also rejected Mr Bouteflika's offer this week that he would go by the end of his current term - 28 April - as not quick enough.

It seems the powerful military agreed. Its chief, Lt Gen Ahmed Gaed Salah, said earlier on Tuesday: "There is no more room to waste time."

What next?

The demonstrations have also called for the whole political system, in which the military plays a significant role, to be overhauled.

Many of the protesters are young and say they want a new system of government.

There were accusations that Mr Bouteflika was being used as a front by "le pouvoir" - a group of businessmen, politicians and military officials - to retain their power.

Elections originally scheduled for 18 April were postponed and the governing National Liberation Front (FLN) vowed to organise a national conference on reforms.

The FLN has ruled Algeria since the country won independence from France in 1962 after seven years of conflict.

Mr Bouteflika, who came to power in 1999, strengthened his grip after a bloody civil war against Islamist insurgents which left 150,000 dead.

The chairman of the upper house of parliament, Abdelkader Bensalah, is expected to become caretaker president for three months until elections.

Mr Bensalah has been in post since 2002 and has represented Mr Bouteflika at official visits and events.

He also shares a similar background with the president, growing up in neighbouring Morocco before returning to fight in the liberation war.

Who is Bouteflika?

He is a veteran of Algeria's war of independence who served as foreign minister for more than a decade before becoming president in 1999.

His primary task was to rebuild the country, and its economy - but first, he needed to end Algeria's brutal civil war sparked by the military's refusal to recognise the election victory of the Islamic Salvation Front in the early 1990s.

Despite guaranteeing stability in the oil-rich nation, his government has been accused of widespread corruption and state repression.

The man who once said he would not accept being "three-quarters a president" spent his last years in a wheelchair after a stroke in 2013, rarely appearing in public, and fuelling fierce debate over who was really in charge, the BBC's North Africa correspondent, Rana Jawad, says.

Revolutionaries praise him for welcoming Che Guevara to Algeria, and giving a young Nelson Mandela his first military training.

BBC


(Yes)