ALGIERS (Reuters) - The body of Algeria’s powerful army chief - the former independence fighter who became his country’s de facto ruler - was carried to his grave on a tank on Wednesday as hundreds of thousands of mourners looked on.

Slideshow ( 11 images )

Lieutenant general Ahmed Gaed Salah, who masterminded the state’s response to mass protests this year, died of a heart attack on Monday, aged 79.

He had angered protesters who accused him of working to keep the army and the rest of the ruling elite in power after he helped oust long-time president Abdelaziz Bouteflika in April.

But many in the crowd in Algiers on Wednesday gave him the credit for the army’s largely restrained response to the mass demonstrations that rocked cities across the North African nation.

“He did the right thing when he ensured the safety of the millions who marched ... demanding change,” said Abdesselam Selami, a 52-year-old telecoms worker waiting to pay his respects in the streets. “No one was killed,” Selami told Reuters by phone.

Gaed Salah pushed for an election to replace Bouteflika - a vote that many protesters dismissed as a charade, saying that the army chief kept the reins of power.

When Abdelmadjid Tebboune was sworn in as the new president this month, he brought Gaed Salah onto the stage, embraced him and presented him with an order of merit.

The old general died four days later and Tebboune swiftly appointed Said Chengriha, head of the land forces, to the top army job. Chengriha, like Gaed Salah and most of Algeria’s other rulers since independence, is a veteran of the guerrilla war against French rule.

Gaed Salah lay in state in the capital’s Palais du Peuple. On Wednesday, his coffin was draped in the national flag and covered in flowers and paraded the streets to the el-Alia cemetery east of the city.

“It is huge. Hundreds of thousands,” said book publisher Mohamed Mouloudi in the crowd.