It is unclear how much of a free hand Mr. Tebboune, the new president, will have in running the country, with the military leaders in General Gaïd Salah’s circle still in the background. The “red line” the president cannot cross, according to Mr. Stora, is “the army’s role in the economy,” including the generous funding it receives, making it the top arms buyer in Africa.

General Gaïd Salah began his military career as a teenager in the national liberation army fighting the French. He later trained at a Soviet military academy and rose through the ranks of the Algerian army, becoming head of ground forces in Algeria’s bloody 1990s civil war with the Islamists.

He had formed a strong alliance with Mr. Bouteflika in the early 2000s, ever since the Algerian president saved him from a forced early retirement. As Mr. Bouteflika’s vice-minister of defense, he helped his benefactor dismantle the country’s powerful internal security services.

For years, General Gaïd Salah dutifully stood in the shadows, ready to back Mr. Bouteflika but never stealing the limelight. And the government showered cash on him and his army from the country’s oil earnings.

“The death of General Gaïd Salah is a harsh blow to the System, which will be somewhat destabilized,” Nacer Djabi, a leading sociologist, said Monday in Algiers. “Obviously, his personality counted for a great deal in the way the situation was unfolding.”

“This was a man who had been able to break with the Bouteflika system, relying at first on the Hirak, and who also did a lot in the fight against corruption,” Mr. Djabi said. “For Algerians, he did some things that were scarcely believable, including the arrest of a number of important figures, but we’re just going to have to wait to see what the real impact will be.”