Algeria’s powerful army chief of staff turned against the country’s ailing president Abdelaziz Bouteflika on Tuesday in a dramatic development, calling for the invocation of a constitutional clause declaring his office vacant.

Army chief of staff Ahmed Gaid Salah, also the country’s deputy defence minister, is the most senior official to turn against Mr Bouteflika amid weeks of mass protests calling for him to resign rather than seek a fifth term.

Some of the protesters and activists participating in the weeks-long uprising against the regime, however, saw in the declaration a stage-managed attempt to push Mr Bouteflika from power – without sacrificing the positions and privileges of the generals, security officials, and business leaders who make up the elite.

“This is the perfect coup,” said one Algiers activist and journalist. “The army is saying to the protesters, ‘Take Bouteflika and go home.’”

Several major opposition political parties, who have been swept up by the protests rather than leading them, quickly rejected General Salah’s intervention.

The bold move was quickly followed by a reported convening of the constitutional court, which has the authority to remove Mr Bouteflika. The sequence suggested behind-the-scenes manoeuvres by powerful, shadowy figures within the elite to attempt to defuse a budding crisis by pushing Mr Bouteflika out and handing power to the head of the upper chamber of parliament, Abdelkader Bensalah.

Mr Bouteflika, who is 82, has been president since 1999, but has been wheelchair-bound and has not delivered a public speech since suffering a stroke in 2013.

Algerians protest against President Bouteflika Show all 14 1 /14 Algerians protest against President Bouteflika Algerians protest against President Bouteflika Protests against President Bouteflika in Algiers on March 15 Reuters Algerians protest against President Bouteflika Protesters march in Algiers to demand the resignation of President Bouteflika on March 15 Reuters Algerians protest against President Bouteflika Protesters carrying the national flag protest against President Boueflika on the Republique Plaza on March 17 AP Algerians protest against President Bouteflika Algerians march during a protest in Algiers on March 15 AP Algerians protest against President Bouteflika Students protest in Algiers on March 19 Reuters Algerians protest against President Bouteflika Protesters hang national flags atop a building in Algiers on March 15 Reuters Algerians protest against President Bouteflika Algerian doctors protest against President Bouteflika on March 19 in Algiers EPA Algerians protest against President Bouteflika Algerians demand the resignation of President Bouteflika in a protest on March 15 in Algiers AFP/Getty Algerians protest against President Bouteflika A woman holds a placard with the photo of President Bouteflika during a protest on March 15 in Algiers AP Algerians protest against President Bouteflika Algerians demand the resignation of President Bouteflika in a protest on March 15 in Algiers AFP/Getty Algerians protest against President Bouteflika Algerian doctors march against President Bouteflika on March 19 in Algiers EPA Algerians protest against President Bouteflika Algerians take part in a demonstration against President Bouteflika on March 19 in Algiers AFP/Getty Algerians protest against President Bouteflika Algerian doctors protest against President Bouteflika on March 19 in Algiers AFP/Getty Algerians protest against President Bouteflika Employees of the Algerian Ministry of Vocational Education and Training protest against President Bouteflika in Algiers on March 18 EPA

“We must find a way out of this crisis immediately, within the constitutional framework that is the only guarantee to preserve a stable political situation,” said General Salah in an address broadcast on state television. The 79-year-old general wore camouflage military fatigues as he spoke.

“The solution that must be adopted to end the crisis and answer the legitimate demands of the Algerian people, is the solution that guarantees the sovereignty of the constitution and the continuity of the state. This solution achieves consensus and must be accepted by all.”

Algeria’s powerful armed forces have long played a lynchpin role in politics. Following impending 1991 election victories by Islamists, they rolled back democracy and ignited a vicious civil war that continues to haunt the country.

Many observers likened General Salah’s speech, held before a military audience, to the 2011 announcement by Egyptian generals that ousted longtime president Hosni Mubarak but ensured the power of the military and its cronies.

“What is worrying is Salah announcing it himself,” said the journalist and activist, “with his legendary authoritarian tone”.

Article 102 of the country’s constitution allows Algeria’s constitutional court to declare the presidential post vacant if the officeholder is unable to carry out his duties, and ask the parliament to declare him unfit. It also allows for the extension of parliamentary terms of office in exceptional circumstances.

General Salah’s call for Mr Bouteflika’s departure was all the more surprising as he was largely seen as a loyalist to the president. The senior officer, a veteran of the 1954-1962 war of independence from France, was elevated by Mr Bouteflika to the post of army chief of staff in 2004, and deputy defence minister in 2013.

Mr Bouteflika for years deftly balanced the dozen or so power centres within Algeria’s networks of rival cliques that span commerce, the armed forces, and the intelligence networks. But the waves of protests against his fifth term by Algerians fed up with the regime’s perceived corruption and mismanagement of the oil and gas-rich country of 42 million, have pushed the country to the brink.

“The Algerian army’s move was predictable as the Bouteflika clan had no plan B,” said Tarek Cherkaoui, North Africa specialist at TRT World Research Centre, a think tank associated with Turkey’s public broadcaster. “The massive and unprecedented demonstrations created a potentially dangerous vacuum. Moving forward, the devil will be in the details of how the transition will be managed.”

Algerians across the country protest against the regime

When Egypt’s generals announced Mr Mubarak’s departure, the protesters gathered in Cairo’s Tahrir Square cheered, chanting “the army and the people are one hand”.

Two years on, the military under now president Abdel Fatah el-Sisi staged a coup, toppling Egypt’s only legitimately elected government and ushering in the most repressive era in the country’s history.

Few in Algeria cheered General Salah’s announcement.

Two Islamist parties quickly rejected the formula, pushing instead for the roadmap approved by a group of opposition parties earlier this month.

“It is a solution that does not conform with the demands of the Algerian people,” Islamist Justice and Development Front leader Abdallah Djaballah was quoted as saying in local media.

The predominantly Berber, left-leaning Rally for Culture and Democracy party called Gen Salah’s statement tantamount to a “coup attempt”.

On social media, there were no calls to abandon plans for huge anti-government protests later this week.