PARIS, March 23, 2018 (News agencies) - French police killed a gunman who shot dead at least three people and injured two others in a hostage-taking and shooting spree in southwest France on Friday. The attacker had began his rampage by hijacking a car in Carcassonne on Friday morning, in which he killed a passenger and injured the driver. He then shot at a group of policeman, injuring one officer before driving to the supermarket, where he opened fire leaving two dead. A witness who was in the supermarket at the time of the incident told France Info: "A man shouted and fired a number of times. I saw a fridge door, I asked people to come and get in. There were ten of us and we stayed there for an hour. There were more shots and we went out the back door. (...) He shouted 'Allahu...something', I did not see him." Shoppers fled in panic and many were able to leave by an emergency door before taking refuge in a nearby garage. After taking several shoppers hostage the gunman, who pledged allegiance to terror group IS, was killed in a police raid shortly after 2pm. A policeman who was involved in negotiating the release of several hostages was hurt in the operation to kill the gunman. Authorities took the step of evacuating the historic centre of Carcassonne, where pupils were locked in schools and tourists were confined to hotels and shops. According to numerous reports the gunman shouted "Allahu Akbar" as he opened fire. Specialist counter-terrorist prosecutors in Paris have opened an investigation meaning they are treating the incident as a terror attack. Hundreds of police surrounded the building as helicopters hovered overhead. "One witness named Karim, 55, told France info radio: "I heard shots fired around 11:10am. At that moment there were only a few gendarmes (military police) around but now there are between 200 to 300. "The whole area is in lockdown and we are going to be moved away by the gendarmes." Another witness who worked at a nearby garage said: "There are gendarmes in front of the supermarket. We are locked in the garage with around 50 people. We are waiting." Local authorities tweeted that the area was out-of-bounds to the public. According to reports the policeman who was shot in Carcassonne was part of a group of unarmed CRS police based in Marseille who were jogging at the time they were targeted by a gunman. The policeman who was shot is in a stable condition and his life is not at risk, according to reports in the French press. It is believed the gunman initially tried to run them over in a vehicle before opening fire. "They threw themselves to the floor but one of them was hit in the shoulder," a source told France Info radio. A state of emergency put in place just after the Paris attacks was finally lifted in October last year, but soldiers continue to patrol major tourist sites and transport hubs under an anti-terror mission. If the link to Islamic State is confirmed, the hostage-taking would be the first deadly attack in France since October, when two young women were stabbed to death outside Marseille's main train station. The area of southwest France where Friday's shootings took place has been scarred by Islamic extremism before. In 2012, Mohamed Merah shot dead seven people including three Jewish schoolchildren in nearby Toulouse and Montauban.