And he supported a scholarship project, run with the help of an Israeli scholar, that uncovered a rare, 1,000-year-old Hebrew Bible.

But Mr. el-Sisi’s embrace of Egyptian Jews is also awkward and laced with contradictions. The visit of 180 Jews took place under a news media blackout, with no coverage in Egyptian outlets, and amid iron-tight security by Egyptian officials who at times outnumbered their visitors.

Although Mr. el-Sisi paints himself as a moderate, he has done little to counteract anti-Semitism in Egyptian society, where Jews are often conflated with Israel, and where many young Egyptians know little of their country’s Jewish past — and how it ended.

“I’m full of questions,” said Philippe Ismalun, who fled Egypt after his father was arrested during the 1967 Middle East war. “After so many years of Jews being told that Egypt is not their country, not their home, it was puzzling to see the government spend so much money and effort on renovating the synagogue.”

In part, the answer is politics.

Perhaps 16 Egyptian Jews remain in Egypt — six in Cairo and another 10 in Alexandria, mostly in their 70s and 80s, according to community leaders in both cities. The government says it is rescuing their synagogues and cemeteries so Jewish heritage can take its rightful place alongside Egypt’s Pharaonic, Coptic and Islamic civilizations.