French police have arrested a man in the search for a driver who slammed his BMW into soldiers in a Paris suburb, leaving six of them wounded in what appeared to be a carefully timed ambush before he sped off.

The motive for the attack is unclear, but officials said he deliberately aimed at the soldiers, and counterterrorism authorities have opened an investigation. It is the latest of several attacks targeting security forces guarding France over the past year. While others have targeted prominent sites like the Eiffel Tower, Wednesday's attack hit a leafy, relatively affluent suburb that is home to France's main intelligence service, the DGSI.

They must've really planned this. — Jean-Claude Veillant , resident

Three of the soldiers suffered minor injuries while three were more were seriously hurt, but their lives are not in danger, according to the Defence Ministry.

They were from the 35th infantry regiment and served in Operation Sentinelle, created to guard prominent French sites after a string of deadly Islamic extremist attacks in 2015.

Witnesses described seeing a BMW with one person inside waiting in a cul-de-sac near a building used for Sentinelle soldiers, according to two police officials. One official said the attacker hit just as a group of soldiers emerged from the building to board vehicles for a new shift.

Authorities checked video surveillance of the area, near the city hall of Levallois, northwest of Paris, and police fanned out around the French capital and stopped numerous cars as they searched for the attacker.

Most were released. But in one case, police stopped a car on the A16 highway and arrested the driver, and were verifying his possible links to the attack, according to two police officials. One of the officials said the arrest was violent and police fired at the suspect to subdue him. The officials weren't authorized to be publicly named because of an ongoing police operation.

Police shot and wounded the suspect during the confrontation on the highway. A policeman was also injured by a stray bullet.

Officials later said police were searching a building in a suburb west of Paris believed to be linked to the suspect. Heavily armed police in masks could be seen entering and leaving the building.

The same officials said the suspect's identity has not been confirmed and it's unclear whether he lived in the building.

Police officers and emergency workers stand next to the suspect's damaged BMW car after he was arrested on the A16 motorway, near Marquise. (Philippe Huguen/AFP/Getty Images)

'Follow that car'

A witness to the Levallois attack described an ear-piercing scream of pain that is still echoing through her head.

Nadia LeProhon, 45, was startled by a loud crash outside her building and rushed outside her seventh-floor window to see two soldiers on the ground. Other soldiers ran after a speeding car, shouting "After him! Follow that car!"

"I'll never forget that scream — a scream of pain and distress," she told The Associated Press.

The street is normally guarded by posts that are removed when vehicles move in and out, according to residents. The driver must have known exactly when to strike, said resident Jean-Claude Veillant, 70.

Veillant said he saw two uniformed soldiers prone on the ground when he came down to the entrance of his 13-storey building at 7:50 a.m. local time Wednesday.

"It was horrible," he said, explaining that both soldiers appeared to be in bad shape and that one of them was unconscious.

"They must've really planned this," he said.

A woman stands by a security perimeter after the crash. The driver's motive is unclear, but officials said he deliberately aimed at the soldiers. (Christophe Petit Tesson/EPA)

'Odious attack'

Levallois Mayor Patrick Balkany called it an "odious attack" and said it was "without a doubt deliberate."

"A BMW pre-positioned itself in the alley [where the barracks is located] and barrelled into them," he said on BFM television. He said the car "accelerated very quickly when they left" the building.

A security perimeter was installed around the scene, and the defence minister and interior minister are expected to visit wounded soldiers Wednesday afternoon.

French counterterrorism prosecutors opened an investigation aimed at pursuing perpetrators on charges of attempted murder of security forces in connection with a terrorist enterprise, the Paris prosecutor's office said. The move means authorities believe the attack was deliberate and planned with a terrorist motive.

French President Emmanuel Macron has pledged to boost military spending and entrench security measures after a string of Islamic extremist attacks since 2015.