REUTERS - A Frenchman who pledged allegiance to Islamic State stabbed a police commander to death outside his home and killed his partner, who also worked for the police, in an attack the government denounced as "an abject act of terrorism".

Larossi Abballa, 25, also took the couple's three-year-old son hostage in Monday night's attack. The boy was found unharmed but in a state of shock after police commandos stormed the house and killed the attacker.

Born in France of Moroccan origin, Abballa was jailed in 2013 for helping Islamist militants go to Pakistan and had been under security service surveillance, including wiretaps, at the time of the attack, Paris prosecutor Francois Molins said.

Open gallery view An undated photo taken from Facebook shows Larossi Abballa, 25, who stabbed two police officials in Magnanville, France, June 13, 2016. Credit: AFP / Facebook

The attacker told police negotiators during the siege he had answered an appeal by Iraq-based Islamic State chief Abu Bakr al-Baghdadi "to kill infidels at home with their families", Molins told a news conference.

"The killer said he was a practicing Muslim, was observing Ramadan and, that three weeks ago, he had pledged allegiance to ... Abu Bakr al-Baghdadi," Molins said.

Police found a bloodied knife at the scene along with a list of other potential targets including rap musicians, journalists and police officers, the prosecutor said.

Open gallery view A police vehicle blocks the road after a police commander and his partner were stabbed to death in Magnanville, west of Paris, France, June 14, 2016. Credit: Matthieu Alexandre, AFP

The killings came as France, which has been under a state of emergency since Islamic State gunmen and bombers killed 130 people in Paris last November, was on high security alert for the Euro 2016 soccer tournament, which began last Friday.

In a video posted on social networks, Abballa linked the attack to the soccer championship, saying: "The Euros will be a graveyard."

The video had been removed from Facebook on Tuesday. Michelle Gilbert, a Paris-based spokeswoman for Facebook, said the company's guidelines forbade hate messages and aimed to remove such content swiftly from the website once alerted.

"Abject act of terrorism"

The attacker knifed 42-year-old police commander Jean-Baptiste Salvaing repeatedly in the stomach on Monday evening.

He then barricaded himself inside the house in Magnanville, a suburb 60 km (40 miles) west of Paris, taking the policeman's partner Jessica Schneider, 36, and their boy hostage. Schneider, a secretary at a police station in a nearby suburb, was killed with a knife, Molins said without giving details.

Islamic State claimed the attack. "God has enabled one of the caliphate's soldiers in city of Les Mureaux near Paris to stab to death the deputy police chief and his wife," a broadcast on its Albayan Radio said.

It was the first militant strike on French soil since the multiple attacks on bars, restaurants, a concert hall and the national soccer stadium in Paris in November.

"An abject act of terrorism was carried out yesterday in Magnanville," Interior Minister Bernard Cazeneuve said after an emergency government meeting, before visiting Les Mureaux, where the police commander worked.

President Francois Hollande said the killings were "undeniably a terrorist act" and that the terrorist threat in France was very high.

Police searched Abballa's home and other locations on Tuesday and detained three people close to him for questioning.

Details started to emerge on the profile of the attacker. Abballa was born in the nearby town of Meulan and lived in Mantes-la-Jolie, where he had set up a fast food outlet in April, documents from the Versailles court showed.

He was given a three-year prison sentence in 2013 for helping Islamist militants go to Pakistan. His name appeared in a separate ongoing investigation into a man who went to Syria, but he was not considered a threat, a source close to the investigation said.

Abballa had also been convicted three times on charges of aggravated theft and driving without a licence, another source close to the investigation said.

David Thomson, an RFI radio journalist specialised in Islamic radicalism, wrote on his Twitter page that Abballa had filmed himself at the site of the attack and posted the message on Facebook.

With the couple's boy behind him, Abballa said: "I don't know yet what I'm going to do with him," Thomson wrote.

Islamic State's claim of responsibility came after the Islamist militant group also claimed responsibility for the killing of 49 people at a gay nightclub in Orlando, Florida.

"In Orlando after the terrible homophobic terrorist attacks and Magnanville in a different way, the same ideology of death with the same beliefs (has been at work): kill and spread terror, contest who we are and prevent us from living freely," Prime Minister Manuel Valls told parliament