But then the World Cup came along and with it, a cloudburst of unfiltered national happiness.

For the first time in 28 years, the national soccer team, known as the Pharaohs, qualified. And they got there courtesy of Mr. Salah, a goal-scoring machine who has rocketed to global fame in the past year, fueled by the love of his soccer-mad compatriots.

Mr. Salah is a soccer magician, the ball seemingly glued to his left foot as he weaves around defenders before smashing it into goal. He mostly plays for his club, Liverpool, where he scored a record 44 goals last season in a blazing performance that catapulted him to the ranks of superstars like Cristiano Ronaldo and Lionel Messi. But in this World Cup, he represents his country, Egypt.

The streets of Cairo exploded with joy in October when Mr. Salah scored a dramatic last-minute goal against Congo that propelled the national side into the World Cup finals. Egyptians, riven by so much fear, division and bloodshed since their Arab Spring uprising in 2011, had finally found an undisputed hero.

“Salah is the king,” said Moataz Badr, a 16-year-old high school student, as he left a street cafe in the Cairo district of Agouza after a recent game. “King of Liverpool. King of England. King of Egypt.”

But sport has little respect for fairy tale endings, and intoxicated hopes that Mr. Salah could propel Egypt to the second round of the World Cup crashed to the ground this week. Yet few Egyptians are giving up on Mr. Salah.

In a country where hope is fragile, many see him as a once-in-a-generation star — a moral as well as a sporting force, an ambassador for country and faith.