By Alissa J. Rubin, Aurelien Breeden and Benoit Morenne

New York Times News Service

PARIS — A gunman wielding an assault rifle Thursday night killed a police officer on Paris’ most iconic boulevard, the Champs-Élysées, stirring France’s worst fears of a terrorist attack, which could tip voting in a hotly contested presidential election that starts Sunday.

The gunman was shot dead by police as he tried to flee on foot; two other police officers and a bystander were wounded. Police quickly blocked access to the crowded thoroughfare, lined with restaurants and high-end stores, as a helicopter hovered overhead.

The attack set off panic and a scramble for shelter, and officers began searching for possible accomplices after the attack.

Near midnight, President François Hollande said in an address that the attack appeared to be an act of terrorism. The Islamic State claimed responsibility in a message posted on a jihadi channel, and the Paris prosecutor said he had opened a terrorism investigation.

The attack came only days before the start of a presidential vote that could reverberate across Europe, and as the 11 candidates were having their final quasi-debate on the France 2 television network.

Analysts have been saying for weeks that an attack just before the first vote, or between the first vote and the runoff on May 7, could tip the election toward a candidate perceived as tougher on crime and terrorism, especially far-right leader Marine Le Pen, who hardened her stand against Muslim immigration in the campaign’s final days, linking it to security fears, or François Fillon, who has pledged to eradicate Islamic terrorism.

François Molins, the Paris prosecutor, said that shortly before 9 p.m., a car pulled up to a police vehicle that was parked in front of a Marks & Spencer store. A gunman jumped out and opened fire on the vehicle, killing an officer. The gunman then tried to flee while firing at other officers but was killed by police.

Molins said authorities had identified the killer, but he declined to provide the gunman’s identity because police raids and the search for potential accomplices were underway.

European counterterrorism experts said they believed the Islamic State’s claim was credible.