A man who claimed allegiance to ISIS killed three people in southern France on Friday when he carjacked a vehicle, fired at jogging cops and took hostages in a supermarket before being shot dead, officials said.

The gunman — believed to be a Moroccan who was known to authorities — asked for the release of Salah Abdelslam, the prime suspect in the 2015 attack in Paris that killed 130 people.

ISIS later claimed responsibility for Friday’s attack.

He first hijacked a car in the town of Carcassonne, where he killed a passenger with a shot to the head and wounded the driver before speeding off toward nearby Trèbe, Agence France-Presse reported.

Along the way, he opened fired on four unarmed cops based in Marseille who were out for a jog, said Yves Lefebvre, secretary general of the SGP Police-FO police union.

One officer suffered a non-life-threatening shoulder injury, Lefebvre said.

It was believed the attacker initially tried to run the officers over before opening fire, The Local reported.

“They threw themselves to the floor but one of them was hit in the shoulder,” a source told France Info radio.

The jihadist then proceeded to Trèbes, a picturesque medieval town of about 5,000 residents, where he shouted “Allahu Akbar!” – Arabic for “God is greatest” – before storming into a Super U supermarket.

“You’re bombing Syria! You’re going to die!” he yelled as he claimed allegiance to ISIS and opened fire, the local prosecutor’s office said.

A butcher and a customer were killed in the assault, which also left about a dozen other people injured, officials said.

“A man shouted and started firing several times,” a shopper told FranceInfo radio station. “I saw an open door for a refrigerated area and I told people to come to shelter there. We were 10 people and we got out by the emergency exit at the back.”

After releasing dozens of hostages, he remained holed up in the store with a gendarme, a military police officer, who had swapped himself in exchange for one of the captives, Le Figaro newspaper reported.

A more than three-hour siege ended when anti-terror police stormed the supermarket and killed the gunman.

The 45-year-old gendarme and another officer were injured during the exchange of gunfire, according to France 24.

The attacker, who was not immediately named, was identified as a 25-year-old French-Moroccan national who was known to intelligence services for having been radicalized, The Local reported.

According to local reports, he was armed with one or more grenades, a handgun and knives.

Police later raided his home in Carcassonne, Le Parisien newspaper reported, as well as the homes of his associates and relatives.

One neighbor said the suspect was a pleasant young man who was “calm, friendly and always had a nice word to say,” the Telegraph of the UK reported.

He lived in an apartment block with his parents and sisters, and would take the youngest child to school daily, the paper reported.

Shortly before the hostage-taker was shot dead, President Emmanuel Macron said all evidence suggested that the incident was a terrorist attack.

Speaking in Brussels, where he was attending an EU summit with with German Chancellor Angela Merkel, Macron offered his “full support” to everyone involving in the situation and said he would return to Paris.

The killing spree came with France still on high alert after a series of jihadist attacks since early 2015, when an assault on satirical magazine Charlie Hebdo left 12 people dead.

The hostage situation at the Super U drew parallels to the anti-Semitic attack on a kosher supermarket outside Paris in January that year in which four people were killed.

In that case, the attacker had also declared his allegiance to ISIS.

In November 2015, ISIS jihadists launched attacks in Paris, where 130 people were killed in bombings and shootings at bars, restaurants, the Bataclan concert venue and the national stadium.

And in July 2016, in another attack claimed by the terror group, a man drove a truck through revelers celebrating Bastille Day in the Riviera resort of Nice, killing 84 people.

Abdeslam, a 28-year-old French national of Moroccan descent, is awaiting trial as he sits in solitary confinement in a high-security prison near Paris.

He has admitted helping coordinate the 2015 attacks, but failed to detonate his suicide bomb vest out the Stade de France, France’s national sports stadium, during a soccer match between France and Germany.

With Post Wires