A suspected Islamist attacker stabbed a French police commander to death outside his home and later killed his partner in an attack claimed by Islamic State and denounced by the government as "an abject act of terrorism".

The attacker, a 25-year-old who went to jail in 2013 for helping Islamist militants go to Pakistan and had been monitored by security services, repeatedly knifed the 42-year-old commander in the stomach late on Monday.

He then barricaded himself inside the house in Magnanville, a suburb some 60 km west of Paris, taking the policeman's partner and three-year-old son hostage. His partner, an administrative police official, was found dead in the house. The boy was unharmed but in a state of shock, an Interior Ministry spokesman said.

The man, whom police and justice sources named as Larossi Abballa, was shot dead by members of an elite police unit after negotiations failed.

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

Police searched Abballa's home and other locations on Tuesday and detained two people close to him for questioning, a police source said.

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, which began last Friday.

Police are under "extreme pressure" and "close to burn-out," the head of FO labor union Jean-Claude Mailly told France 2 television.