I felt the complexity of these dilemmas everywhere I went in Fez. I felt them in the comments of the boys in the mellah streets. I felt them in the Jewish cemetery, whose graves, only recently fully cataloged, spread over a large sloping plot where notable rabbis are set off in a separate section and prolific offerings (including olives and fruit) are left for Sol Hachuel, a Jewish female saint whom both Jews and Muslims venerate for her defiance of forced conversion, one of several examples of such shared worship that is specific to Morocco.

And I felt it especially in the most particular museum created by Edmond Gabbay in the former school that adjoins the cemetery in Fez. Stepping into Mr. Gabbay’s museum was like entering a three-dimensional story by Jorge Luis Borges. One of the remaining Jews of Fez (under 100, all living in the new city), Mr. Gabbay, 81, has made it his mission to collect and display the goods and chattels the Jews left behind: the passports and report cards; the eye charts; the baskets spilling over with prayer shawls; the stuffed animals; the hats and clothes; the mixing bowls and soccer balls; and the books (“Jane Eyre” next to Simone Signoret next to Maimonides, who lived and wrote in Fez in the 12th century). Why had Mr. Gabbay scooped it all up and laid it all out as a kind of profuse if dizzyingly inverse flea market? “Because it shows that we were here,” he said. “And one day people will forget.”

He was not the only person I met who was preoccupied with the vanished Moroccan Jews.

In Casablanca I visited the Moroccan Jewish Museum, the only Jewish museum in any Arab country, where the more conventional display of Jewish-Berber costumes and jewelry, scores of hands of Fatima pendants, and an entire goldsmith’s workshop from the mellah of Fez express new expectations of inclusion laid out in the preamble to Morocco’s 2011 constitution. Drafted after events of the Arab Spring, it specifically acknowledges the “Hebraic” contributions to the country’s “diverse, indivisible national identity.”

Image Edmond Gabbay, whose museum in Fez includes old passports the Jews left behind. Credit... Ingrid Pullar for The New York Times

Afterward I had lunch with Vanessa Paloma, a singer, scholar and oral historian whose inspiring work has turned her into a kind of one-woman roving museum of her own. For 20 years Ms. Paloma has been committed to preserving everything associated with Moroccan Jewish music: songs (which she performs), recordings (which she archives), sheet music and photographs (which she collects) and, most recently, oral histories (which she takes herself). “Right now in Morocco it feels like there’s a limb that is missing,” she said. “Young people realize there is something in their culture that they don’t have easy access to. Old people long for what is gone.”

In Marrakesh, my next stop, I found that parts of its mellah were undergoing the early stages of gentrification that are likely to have a very mixed effect on this storied place. Scaffolding covered the gate associated with a famous miracle that took place when a band of tribesmen approached the neighborhood intent on pillaging, and a man called Murdukhai ben Attar, who was the Jewish community’s representative to the Muslim authorities, prayed for divine intervention. A barrier of flames leapt up, and the attackers retreated. The gate was forever after painted blue, and for centuries passers-by would kiss its sides, which were believed to mark the beginning of a sacred and protected space. (Murdukhai ben Attar is another shared saint buried in the nearby Jewish cemetery.)

I found the vivid blue paint intact only on the inside of the arch, which gives way to a bustling street of spice, fabric and passementerie vendors whose wares echo those once sold by the neighborhood’s Jewish inhabitants. While a handful of shops just outside the gate still have Jewish owners, only three Jewish families reside in the mellah itself, one of them virtually in the Synagogue Lazama.