CAIRO — It was well after midnight when Mahmoud Hifny finally lost it.

He had sweated through traffic while his fuel needle hovered ominously over the red “E” and finally joined a snaking line leading to one of the few downtown gas stations still pumping fuel. Two hours later, he was still waiting, stranded in an exhaust-choked sea of cars whose drivers had also lost hours trying to fill their tanks.

“We’ll get rid of those sons of dogs!” Mr. Hifny, 42, yelled to no one in particular, though everyone knew he meant President Mohamed Morsi and his allies. Nearby drivers nodded their heads. “They’re responsible for all the problems in this country!”

A powerful confluence of crises is engulfing Egypt as summer temperatures reach punishing heights, fraying tempers and fueling anger among many toward the country’s leaders.

Economic malaise is spreading just before Ramadan, the year’s costliest season for Muslims who fast by day and celebrate at night. Adding to tensions, the government has failed to ease frequent electricity cuts and a worsening fuel crisis that has left gas lines clogging major thoroughfares for hours.