PARIS — The suspect in the beheading of a history teacher in a Paris suburb was an 18-year-old immigrant of Chechen descent who was angered by the classroom display of caricatures of the Prophet Muhammad, French officials said on Saturday.
The suspect, identified by the authorities as Abdoulakh A., stalked the area outside the school on Friday afternoon before following the teacher, whom he stabbed and decapitated with a knife, Jean-François Ricard, the top antiterrorism prosecutor, said at a news conference.
“The individual was in front of the college in the afternoon and asked students to indicate the future victim to him,’’ Mr. Ricard said, referring to the middle school where the teacher, Samuel Paty, had taught. The suspect was fatally shot by the police in a confrontation soon after the killing, which took place in Eragny, a suburb near the school.
Investigators found a message planning the attack on the suspect’s cellphone, written a few hours before, Mr. Ricard said. Then, shortly before he was killed by the police, the suspect uploaded a photograph of the victim to Twitter, he added.
The gruesome killing appeared to be the culmination of a couple of weeks of tension at the school, Collège du Bois-d’Aulne, in a quiet, middle-class suburb north of Paris. Muslim parents upset over the classroom display of two caricatures published by the satirical magazine Charlie Hebdo had contacted school and police officials, but videos uploaded on social media by one father widened the dispute to an outside audience.
Investigators were still trying to piece together how the suspect spent his days before the attack, Mr. Ricard said. But the suspect did not appear to have any direct ties to the school or to have been previously involved in the dispute.
Born in Moscow, the suspect lived in France with the status of a refugee, Mr. Ricard said, adding that he was not known to antiterrorism officials.
The brutal killing was the second violent episode within weeks to be linked to the caricatures published by Charlie Hebdo, which had led to deadly attacks in Paris in 2015. Last month, as the trial of accomplices in the 2015 attack got underway, the magazine republished the drawings — an act that was seen as a bold statement in the name of freedom of expression by some but as reckless and unnecessary provocation by others.
Last month, a 25-year-old Pakistani immigrant attacked two people outside the former offices of Charlie Hebdo, apparently angered after watching videos showing protests in Pakistan against the republication of the cartoons.
Beyond its brutality, Friday’s killing hit a far bigger nerve in France as President Emmanuel Macron and other top government officials rushed to the scene on Friday evening.
Jean-Michel Blanquer, the minister of national education, said that in Friday’s killing, it was “the republic that was attacked.’’ France said a ceremony would be organized to pay national homage to the slain teacher.
The minister’s words reflected the central role played by France’s public schools — hewing to a national curriculum established by the central government — in instilling civic values and a national identity. But they also underscored the recurring tensions between France’s traditional republican values and those of newer arrivals, especially those of Muslim faith who oppose the publication of the caricatures.
The tensions at Collège du Bois-d’Aulne emerged early this month as the teacher — who was 47 and, according to parents and students, had taught at the school for only few years — broached the topic of freedom of expression.
To illustrate the topic, the teacher showed his students — mostly 13-year-olds — two caricatures of the Prophet Muhammad that had appeared in Charlie Hebdo, Mr. Ricard said. According to an email sent later to the parents by the school principal, the teacher asked students who might be offended by the material to look away or to temporarily leave the classroom. The teacher realized his clumsiness and apologized, according to the email, which was obtained by The New York Times.
Cécile Ribet-Retel, the president of PEEP de Conflans, the local chapter of a national parents’ association, said her group heard from about 20 parents, who expressed their anger or their support for the teacher. Parents met with school officials and both sides appeared to be working toward an understanding, Ms. Ribet-Retel said.
“But then the information got on social media, was amplified and distorted,’’ Ms. Ribet-Retel said. “And it became impossible to manage.’’
One particularly vocal parent — the father of a 13-year-old girl who was upset by the caricatures — met with the principal and demanded that the teacher be fired, Mr. Ricard said. The father uploaded critical and angry videos on social media on Oct. 7 and Oct. 12, identifying the teacher and the school, he said.
Laurent Brosse, the mayor of Conflans-Sainte-Honorine, the Paris suburb where the school is, said local officials warned police intelligence that the situation appeared to be spiraling out of control because of the video.
“We did what seemed important to us at that moment,’’ Mr. Brosse said, adding, “We know that this question about the freedom of expression stirs up tensions in society.’’
But despite these warnings, “there was no action,’’ Ms. Ribet-Retel said.
The video was widely shared on social networks by individuals denouncing anti-Muslim racism and even official accounts of mosques and of Muslim organizations.
“It was blown out of proportion in the Muslim community,’’ said Siham Touazi, a councilor in an adjoining municipality, who received messages linking to the video in several WhatsApp groups.
The killing came just weeks after Mr. Macron unveiled a plan to combat what he described as the threat of “Islamist separatism” to France’s secularism. Mr. Macron focused in part on education, especially on beating back what he described as threats to the secular values taught in the nation’s schools and citing the example of Muslim parents who were opposed to letting their children take swimming lessons.
“The situation has become so tense in our country over the issues of secularism and Islam that it’s become impossible to have a reasonable conversation,’’ said Gérard Pommier, the national president of PEEP, the parents’ association.
The slain teacher — described by Ms. Ribet-Retel and many current and former students as a committed and serious instructor — appeared to try to navigate the tensions in his class on freedom of expression. While he showed two caricatures to his class, he suggested that those who might be offended — implicitly Muslim students — leave or look away. In France, where it is illegal to ask people their religion, the teacher’s proposal seemed to violate the country’s secularism, said Rodrigo Arenas, co-president of the F.C.P.E., another parents’ association.
Aude Clabaut, a teacher at another school in the area, said that the slain teacher should not have asked students to leave the classroom. But she said that she was frustrated by the growing challenges to secularism in her own classroom, with some students refusing to remove their veils and Muslim parents contesting secularism courses.
“I am sad and I am furious,” said Ms. Clabaut, who joined a group of people on Saturday in front of the school where the slain teacher worked.
Hundreds of students and parents, as well as residents of the city, gathered to pay tribute to the teacher, at one pointing singing La Marseillaise, the national anthem.
Some held signs that read “I am a teacher,” in direct reference to the “I am Charlie” support signs that popped up by the thousands hours after the 2015 attack on the magazine. Several students hugged each other, their eyes swollen with tears.
But tensions were also present on Saturday afternoon, as some did not hesitate to directly point to Islamism. A man holding a sign — “ Political Islam is a cancer. We eliminate it or we die from it” — was briefly interrogated by the police and had his sign seized.
Constant Méheut reported from Conflans-Sainte-Honorine. Antonella Francini contributed research from Paris.