ALGIERS (Reuters) - Hundreds of thousands of Algerians rallied on Friday to demand the immediate resignation of President Abdelaziz Bouteflika, who is fighting for his political survival in the face of unrelenting protests and the desertion of long-time allies.

The march remained largely peaceful with police using tear gas only in isolated cases such as to stop youth approaching the presidential palace, a Reuters reporter and state news agency APS said.

Despite heavy rain and cold weather, the turnout was as large as last Friday, as protesters carrying the national flag packed central Algiers, the scene of mass protests for a month.

“We stay here until the whole system goes,” said Mahmoud Timar, a 37-year old teacher.

Bouteflika, 82 and rarely seen in public since suffering a stroke five years ago, bowed to the protesters last week by reversing plans to stand in elections for a fifth term.

But he stopped short of quitting as head of state and said he would stay on until a new constitution is adopted. The move further enraged Algerians, and many of Bouteflika’s allies have turned against him.

“We are close to victory. The system is divided,” said restaurant owner Rachid Zemmir, 55.

Slideshow ( 9 images )

There were also protests in other cities such as Serif, El Oued and Skikda, television footage showed.

ARMY, RULING PARTY BACK PROTESTS

Even if Bouteflika quits, it is not clear if the swelling protest movement can take on the opaque network of ruling party leaders, business tycoons and army generals long regarded as paramount.

These figures may be happy to see Bouteflika go but are likely to resist any major changes, as they have done before.

Bouteflika has a track record of outmaneuvering anyone perceived as a threat. First elected president in 1999, he wrested power from the secretive military-based establishment known as “le pouvoir” (the power).

In 2015, Bouteflika sacked powerful intelligence chief Mohamed Mediene, dubbed “Algeria’s God”. Last year he dismissed about a dozen top military officers.

Slideshow ( 9 images )

In the most dramatic development in a month of demonstrations, Chief of Staff Lieutenant General Ahmed Gaed Salah threw the army’s weight behind the protesters on Wednesday, saying they had expressed “noble aims”.

That was a major setback for Bouteflika, who bolstered his position over the years with the help of the army, and oligarchs who funded his election campaigns.

“The people and the army are brothers,” protesters chanted on Friday. A man held up a FedEx box with a photograph of Bouteflika taped to it beside a Return to Sender stamp.

The military has been patiently watching the protests unfold.

The generals have intervened in the past at momentous times, including cancelling an election which Islamists were poised to win in 1992, triggering a civil war in which an estimated 200,000 people were killed.

Some members of the ruling National Liberation Front party, known by its French acronym FLN, have also sided with the protesters. But Algerians want to dismantle the entire moribund political system.

“FLN, go,” protesters chanted.

They held up a poster with photographs of the people they want to dethrone, including Bouteflika, his brother Said - widely believed to be running the country - and the newly appointed prime minister.

In the past, Bouteflika and his inner circle of fellow veterans of the 1954-1962 war to end French colonial rule, FLN officials and the military skilfully managed crises.

Algerians say Bouteflika, who joined the struggle against France in the 1950s at the age of 19, is out of touch and living in the past.

“The old guard has exploited the country’s wealth. The time has come for us to have our stake,” said hairdresser Mohamed Henni, 32, marching with his wife and children.

By nightfall most protesters had gone, after cleaning up the streets as they have done in previous weeks.