MARSEILLE, France — It was the heavy leather-bound volume of the Torah he was carrying that shielded Benjamin Amsellem from the machete blows.

His attacker, a teenage fanatic who the police say was inspired by the Islamic State, was trying to decapitate Mr. Amsellem, a teacher at a local Jewish school. But Mr. Amsellem used the Torah — the only defense at hand — to deflect the blade and save himself.

It was the third such knife attack since October on a Jew in Marseille, where the Jewish population, around 70,000, is the second largest in France after Paris. And it was the latest example of how France is confronting both the general threat of terrorism, especially after two large-scale attacks in Paris last year, and a particular strain of anti-Semitism that has left many French Jews deeply unnerved.

“This was something claimed by an individual who invoked Daesh, who wanted to kill a Jew. It is extremely serious,” said Marseille’s top police official, Laurent Nunez, in an interview. “Daesh” is an Arabic acronym for the Islamic State, which is also known as ISIS or ISIL.