A police officer was killed and two seriously injured when a gunman opened fire on a cop car along Paris’ busiest street Thursday evening — and ISIS is taking credit for the attack.

Cops killed the shooter at the scene — and say he was someone they’d previously flagged as an extremist.

The terrorist network’s news agency later identified the attacker as Belgian man Abu Yousef al-Belgiki and took credit for the shooting.

The cops were stopped at a red light on the Champs Elysee — a bustling boulevard popular with tourists and famed for its luxury stores and eateries — when the gunman drove up at around 9 pm, pulled out an “automatic weapon” and opened fire, according to a government spokesman.

The attack comes just days before the country’s presidential election, and outgoing president Francois Hollande expressed his deep sorrow for the dead officer’s family at a press conference following the attack.

“I am deeply sad tonight, I would like to express my heartfelt condolences for the policeman gunned down and his family,” he said in French. “We do everything we can to tackle terrorism here and wherever our forces are deployed.”

Local media initially reported that a second officer had died, but authorities later clarified that two other cops are still alive.

Witnesses describe a scene of panic and terror as the gunshots rang out and people tried to hide and run.

Badi Ftaiti, who has lived in Paris for three decades, said he wasn’t alarmed, but others were “running, running . . . Some were crying. There were tens, maybe even hundreds of them.”

Choukri Chouanine said he was serving clients in his restaurant on the rue de Ponthieu when he heard the shots.

“We hid our clients in the basement,” he told Agence France Presse. “I’ve never seen such panic, we hid in the offices, under tables.”

French police claimed to have foiled an “imminent” terrorist attack in the southern city of Marseille two days ago, arresting two men and seizing guns and explosives from their apartments.