The apparently miraculous end to the crippling energy shortages, and the re-emergence of the police, seems to show that the legions of personnel left in place after former President Hosni Mubarak was ousted in 2011 played a significant role — intentionally or not — in undermining the overall quality of life under the Islamist administration of Mr. Morsi.

And as the interim government struggles to unite a divided nation, the Muslim Brotherhood and Mr. Morsi’s supporters say the sudden turnaround proves that their opponents conspired to make Mr. Morsi fail. Not only did police officers seem to disappear, but the state agencies responsible for providing electricity and ensuring gas supplies failed so fundamentally that gas lines and rolling blackouts fed widespread anger and frustration.

“This was preparing for the coup,” said Naser el-Farash, who served as the spokesman for the Ministry of Supply and Internal Trade under Mr. Morsi. “Different circles in the state, from the storage facilities to the cars that transport petrol products to the gas stations, all participated in creating the crisis.”

Working behind the scenes, members of the old establishment, some of them close to Mr. Mubarak and the country’s top generals, also helped finance, advise and organize those determined to topple the Islamist leadership, including Naguib Sawiris, a billionaire and an outspoken foe of the Brotherhood; Tahani El-Gebali, a former judge on the Supreme Constitutional Court who is close to the ruling generals; and Shawki al-Sayed, a legal adviser to Ahmed Shafik, Mr. Mubarak’s last prime minister, who lost the presidential race to Mr. Morsi.