The man who beheaded a teacher in a street in France waited outside the school and asked pupils to identify his target, anti-terrorism officials say.
The man then posted images on social media of dead victim Samuel Paty, 47, who had shown controversial cartoons of the Prophet Muhammad to his students.
The attacker later fired at police with an airgun before being shot dead.
The number arrested rose to 10 on Saturday, with police investigating possible links to Islamic extremism.
The attack took place at about 17:00 (15:00 GMT) on Friday near the College du Bois d’Aulne, where Mr Paty taught, in the town of Conflans-Sainte-Honorine, some 30km (20 miles) north-west of central Paris.
President Emmanuel Macron said the attack bore all the hallmarks of an “Islamist terrorist attack” and the teacher had been murdered because he “taught freedom of expression”.
A national tribute will be paid to Mr Paty on Wednesday.
What is the latest on the attack?
Details of the attack and investigation were given by the anti-terrorism state prosecutor, Jean-François Ricard.
He named the suspect as Abdoulakh A. – an 18-year-old man, born in Moscow of Chechen origin. He came to France with refugee status as a boy and was unknown to anti-terrorism police.
He lived in the Normandy town of Évreux, about 100km (62 miles) from the murder scene and had no apparent connection with the teacher or the school.
The man had been before courts but only on minor misdemeanour charges.
He went to the college on Friday afternoon and asked students to point out the teacher, Mr Ricard said.
The attacker followed Mr Paty, who was heading home on foot after school, inflicted multiple wounds to the head with a knife and then beheaded the victim.
Witnesses are said to have heard the attacker shout “Allahu Akbar”, or “God is Greatest”.
The man then posted photos of the victim to a Twitter account, along with insults to Mr Macron and French “infidels” and “dogs”.
As police approached him, he fired rounds from an airgun at police, Mr Ricard said.
They returned fire. The suspect tried to get up and was shot again, being hit nine times in all.
A 30cm-long (12in) blade was found close by.
What about the investigation?
Mr Ricard said Mr Paty had been the target of threats since he showed the cartoons of the Prophet Muhammad during a class about freedom of speech, in relation to the Charlie Hebdo case.
The French satirical magazine was the subject of a deadly attack in 2015 after publishing the cartoons. A trial over that attack is currently under way.
Mr Paty, a history and geography teacher, advised Muslim students to look away if they thought they might be offended.
- Blasphemy row in France over teen’s post on Islam
- Charlie Hebdo republishes Muhammad cartoons
- Charlie Hebdo attack: Three days of terror
- Paris attacks: ‘I am not Charlie’
A parent of one of the pupils reacted angrily to the incident, accusing Mr Paty of showing naked pictures of the Prophet Muhammad. The father lodged a formal complaint and produced videos demonstrating the anger at Mr Paty’s actions, and calling on people to go to the school to protest.
The father is one of the people in custody, Mr Ricard said, adding that this man’s half-sister had joined the Islamic State organisation in Syria in 2014.
At least one of the other people arrested was known to anti-terrorism police, he said, with other links being investigated.
And at least four of the 10 now arrested are relatives of the attacker.
Mr Ricard said this was the second attack since the Charlie Hebdo trial got under way. A man attacked and wounded two people outside the magazine’s former offices.
Mr Ricard said there was an “ongoing extremely high level of terrorism threat on French soil”.
How is France reacting?
Students were said to be distraught at the brutal killing of a well-liked teacher. One father wrote on Twitter that his daughter “is in pieces, terrorised by the violence of such an act. How will I explain to her the unthinkable?”
One of Mr Paty’s former students, Martial, 16, said he had loved his job: “He really wanted to teach us things – sometimes we had debates”.
The French presidency said a national tribute would be held for Mr Paty, and the hashtag #JeSuisSamuel (I am Samuel) began trending on social media, echoing the #JeSuisCharlie call for solidarity after the attack on Charlie Hebdo.
Speaking at the scene hours after the incident, President Macron stressed national unity. “They will not prevail, they will not divide us,” he said.
Charlie Hebdo on Friday tweeted: “Intolerance just reached a new threshold and seems to stop at nothing to impose terror in our country.”
Education Minister Jean-Michel Blanquer, who met leaders from teaching unions on Saturday, said in a recorded statement that Mr Paty had been killed by the “enemies of freedom” and France would “never back down when confronted by terror, intimidation”.
Muslim leaders in France also condemned the attack. “A civilisation does not kill an innocent person, barbarism does,” Tareq Oubrou, imam of a mosque in Bordeaux, told France Inter.
The Strasbourg-based Assembly of Chechens in Europe said in a statement: “Like all French people, our community is horrified by this incident.”