PARIS — A gunman wielding an assault rifle on Thursday night killed a police officer on the city’s 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 on Sunday.
The gunman was shot dead by the police as he tried to flee on foot; two other police officers and a bystander were wounded. The 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 to the nation 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 the far-right leader Marine Le Pen. She has 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.
“Emotion and solidarity for our forces of order, once again targets,” Ms. Le Pen said after the shooting.
The debate format was one-on-one interviews lasting 15 minutes each, followed by an almost three-minute conclusion, and the presidential candidates quickly posted on Twitter about the attack. Those whose interviews were still being broadcast took the opportunity to speak about their security proposals.
Mr. Hollande, who spoke from the Élysée Palace, offered an emotional tribute to the police, who he said were the country’s first line of defense, and endeavored to reassure a nervous public.
“It has been the case for a number of months, and we will have absolute vigilance when it comes to the elections,” he said, “but everyone will understand that at this hour, my thoughts are with the family of the police who were killed and with those close to the wounded policeman.”
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 the police.
A restaurateur near the scene of the shooting, who would give only his first name, Denis, told France 24 television by phone that people had sought refuge in his restaurant.
“They were scared. They didn’t know what to do, or when it would end,” he said. “Some of them were in shock, others were crying.”
France has been on high alert since the terrorist attacks in and around Paris in November 2015, and this presidential election will be the first to be conducted under such conditions. The authorities have been warning for months that despite the lack of any large-scale attacks, the threat has not abated.
Mr. Molins, who handles terrorism investigations nationwide, said the authorities had identified the killer, but he declined to provide the gunman’s identity because police raids and the search for potential accomplices were still underway.
European counterterrorism experts said they believed that the Islamic State’s claim was credible.
The speed with which the group claimed responsibility was “surprising,” said Peter R. Neumann, the director of the International Center for the Study of Radicalization and Political Violence at King’s College London. “It seems prepared and coordinated,” Mr. Neumann added, noting that the Islamic State claim was in multiple languages, “like they knew this was going to happen.”
On Tuesday, two men were arrested in Marseille on suspicion of having imminent plans to conduct a terrorist attack. Weapons, ammunition and the highly volatile explosive TATP, or triacetone triperoxide, was found in one of the apartments used by the two men. It is the same type of explosive used in the attack at the Bataclan concert hall in Paris in November 2015 and in the attacks in Brussels in March 2016.
The response of all the candidates was to express solidarity with the police, and Mr. Fillon, who represents the mainstream right, and Ms. Le Pen said they would not campaign on Friday, out of respect for the police officers who were killed and wounded.
Emmanuel Macron, a centrist who along with Ms. Le Pen has been leading in the polls, stepped back from the moment, saying: “This imponderable threat, this threat, will be a fact of daily life in the coming years.”
President Trump, who was meeting with Prime Minister Paolo Gentiloni of Italy at the White House on Thursday, responded to a question from reporters about the Paris attack. “That’s a terrible thing, and it’s a very, very terrible thing that’s going on in the world today,” he said. “But it looks like another terrorist attack. And what can you say — it just never ends.”
The French presidential candidates were not alone in using the attack to burnish their image as potential commanders in chief; the Islamic State also appeared eager to make the most of the it, preparing a statement in multiple languages and being ready to claim responsibility, said Michael S. Smith II, a terrorism analyst who specializes in the Islamic State’s influence efforts and who is writing a book on its external operations.
“The timing of the attack itself is significant in that this will help to ensure the group is a centerpiece of political discourses in France,” Mr. Smith said. “For prospective recruits in the West and seasoned jihadis in conflict zones alike, including the Al Qaeda members that the Islamic State has sought to draw into its ranks, this can bolster perceptions of the group as a credible enterprise that is worthy of their support.”