Police have made two arrests in connection with the killings
A man who swore allegiance to Islamic State filmed the murder of a senior policeman and his partner and posted it on Facebook, officials have said.
Police say Larossi Abballa repeatedly stabbed 42-year-old policeman Jean-Baptiste Salvaing outside his home in Magnanville, about 35 miles (55km) west of Paris.
He then took the policeman's partner hostage, together with the couple's three-year-old son.
The woman, who worked at a local police station, was also killed, and their son was "in shock but unharmed", a prosecutor said.
Abballa (25) was killed during a three-hour police operation.
French officials said the attacker posted a 12-minute video of the killings on Facebook Live, the social media site's live feed. His account has been suspended.
One official says that at one point during the attack, Abballa puzzled over the fate of the couple's three-year-old child.
"I don't know what to do with him," he says in the footage, indicating the child sitting behind him on a couch.
The French prosecutor said Abballa attacker had a 'hit list' of VIPs, police and rappers.
Police have made two arrests in connection with the killings. Both people are said to be "linked" to Abballa, who was from the nearby suburb of Mantes-la-Jolie.
Abballa had previously been placed under surveillance, and recently his phone was tapped but without any results, according to a police source.
President Francois Hollande said: "This is incontestably a terrorist act."
"France is not the only country concerned as we have seen in the past days in the United States in Orlando, but we also saw it in Europe and in some other countries in the world, France is facing a terror threat of a very large scale."
Witnesses told investigators that Abballa may have shouted "Allahu Akbar" (God is greatest) as he launched the attack.
Explosions were heard at the scene as heavily-armed police moved in following failed negotiations with the RAID elite police unit.
Abballa was jailed for three years in 2013, six months of which were suspended, for "criminal association with the aim of preparing terrorist attacks", in a trial with seven other defendants.
A Facebook profile bearing the name Larossi Abballa - which has now vanished - showed a photo of a smiling, bearded man.
Two recent posts featured videos critical of Israel and Saudi Arabia.
"Some will say we see evil everywhere!" he said in a message posted about 18 hours before the attack.
In another video he moaned about people not being nice or smiling at him when he delivered food to them.
The Amaq News Agency, which is linked to IS, claimed the attack was carried out by an "Islamic State fighter."
French police are worried about future attacks.
"Today every police officer is a target," said police union chief Yves Lefebvre, adding that attackers are "professionalising" and can now find police in their homes.
France's interior minister Bernard Cazeneuve described the killing of the officer as "an appalling terrorist attack" - and said more than 100 people seen as potential threats have been arrested in recent weeks.
The threat "is high in France, it's high in Europe, it's high in the Western world as shown by the events that happened 48 hours ago in the United States," Mr Cazeneuve added.