CAIRO — When the crowds massed against him at the start of the Arab Spring in January 2011, Hosni Mubarak vowed never to flee his country for an exile in disgrace. “Egypt and I shall not be parted until I am buried in her soil,” he declared.

That came to pass on Wednesday when Mr. Mubarak, 91, Egypt’s ruler of three decades, was buried with full military honors at a funeral in Cairo attended by family, former allies and the country’s latest military-backed strongman, President Abdel Fattah el-Sisi.

“Mubarak passes into God’s custody,” read the headline on the front page of the state-run Al Ahram newspaper.

At a short, tightly choreographed ceremony outside a military-run mosque, Mr. el-Sisi led a procession of mourners behind the coffin of Mr. Mubarak, who died in a hospital on Tuesday from kidney and heart complications.