STRASBOURG, France -- A man who had been flagged as a possible extremist sprayed gunfire near the famous Christmas market in the French city of Strasbourg on Tuesday, killing three people, wounding up to a dozen and sparking a massive manhunt when he got away. France immediately raised its terror alert level.

It was unclear if the market -- a popular gathering place and the nucleus of an al-Qaida-linked plot in 2000 -- was the intended target. The assailant got inside a security zone around the venue and opened fire from there, Mayor Roland Ries said on BFM television.

The market, France's largest, is set up around the city's cathedral during the Christmas season.

Authorities did not give a motive for the shooting, though prosecutors said they had opened a terrorism investigation. Strasbourg, located in eastern France, is home to the European Parliament, one of several places put on an emergency lockdown after the shooting.

The prefect of the Strasbourg region said the man identified as the alleged gunman was on a watch list of potentially radicalized people. Authorities did not name him publicly or provide details such as his age and nationality.

Interior Minister Christophe Castaner, who travelled to Strasbourg, said the suspect had convictions in France and Germany for crimes unrelated to terrorism and served time in prison. He did not elaborate.

Hours before the shooting, French gendarmes went to the suspect's home to arrest him, but he wasn't there, Stephane Morisse of police union FGP said. They found explosive materials during a search, he said.

Many of Europe's deadliest terror attacks in recent years took place in France. In response to Tuesday's shooting, the government decided to take the country's attack risk up a level on the official threat index and to send security reinforcements to Strasbourg, Castaner said early Wednesday.

Strasbourg, a city about 500 kilometres (310 miles) east of Paris on France's border with Germany, promotes itself as the "Capital of Christmas" and the market set up around the local cathedral is a holiday tradition. Two years ago, a Tunisian man drove a hijacked truck into a busy Berlin Christmas market, killing 12 people in the German capital.

Some 350 officers and two helicopters were searching for the assailant, who had been radicalized for "several years" and confronted law enforcement officers twice, exchanging fire, while he "sowed terror," Castaner said.

The death toll stood at three early Wednesday, the minister said. Two police union officials said earlier there were four victims. Officials did not explain the conflicting numbers.

More than seven hours after the bloodshed, the regional prefect said 11 other people were injured, five of them seriously, downgrading Castaner's earlier count of 12 injured.

The shooter was also shot and wounded by soldiers guarding the Christmas market, according to the FGP union's Morisse.

French military spokesman Col. Patrik Steiger said the shooter didn't seem to be aiming at soldiers patrolling in and around the market, but appeared to target civilians instead.

Witnesses described hearing gunshots, screams and shouts of police officers ordering people to stay indoors before the area fell silent and the officers fanned out.

"I heard two or three shots at around 7:55 p.m., then I heard screams. I got close to the window. I saw people running. After that I closed the shutters. Then I heard more shots, closer this time," Yoann Bazard, 27, who lives in central Strasbourg.

"I thought maybe it's firecrackers," he said, speaking by phone. "And then, as it got close, it was really shocking. There were a lot of screams. ... There were police or soldiers shouting 'Get inside!' and 'Put your hands on your head."'

Freelance journalist Camille Belsoeur was at a friend's apartment when they heard the gunfire, which she at first mistook for firecrackers.

"We opened the window. I saw a soldier firing shots, about 12 to 15 shots," Belsoeur said,

Other soldiers yelled for people to stay indoors and shouted 'Go home! Go home!'" to those outside, he said.

Another witness, Peter Fritz, told the BBC one of the four people killed was a Thai tourist who was shot in the head and didn't respond to lengthy attempts to revive him.

"We tried our best to resuscitate him. We applied CPR. We dragged him into a restaurant close by," Fritz said.

He said it took more than 45 minutes for an ambulance to arrive, during which time an emergency doctor advised by telephone "that any further efforts would be futile."

The victim "is still here in this restaurant but we have abandoned all hope for him," Fritz said.

France has been hit in recent years with high-profile extremist attacks, including the co-ordinated attacks at multiple Paris locations that killed 130 people and wounded hundreds in November 2015. A 2016 truck attack in Nice killed dozens.

Tuesday's attack followed four weeks of protests against President Emmanuel Macron that have stretched the police forces deployed to clear blocked roads and to quell rioting, looting and other protest-related mayhem.

Macron adjourned a meeting at the presidential palace Tuesday night to monitor the emergency, his office said. The president tweeted "Solidarity of the whole nation for Strasbourg, our victims, their families" and at midnight presided over a meeting at the Interior Ministry's crisis centre.

The office of the Paris prosecutor, who is in charge of France's terror investigations, said the Strasbourg probe was being conducted on suspicion of murder and attempted murder in relation with a terrorist enterprise. The latter charge suggests officials do not exclude links between the shooter and an extremist cell.

Authorities urged the public to remain indoors at the height of the drama. People dining out at restaurants were held in place for hours. So were thousands of basketball fans who attended a game at a sports stadium and European Union lawmakers in the locked down Parliament.

They eventually were allowed to leave the buildings. People with nowhere to go were offered shelter in a gymnasium, the prefect tweeted.

The Christmas market is set to stay closed Wednesday, when flags in Strasbourg will be flown at half-staff in mourning for the people killed, Mayor Ries said.

The attack revived memories of a new millennium terror plot targeting Strasbourg's Christmas market. Ten suspected Islamic militants were convicted and sentenced to prison in December 2004 for their role in a plot to blow up the market on the New Year's Eve ushering in 2000..

The Algerian and French-Algerian suspects -- including an alleged associate of al-Qaida leader Osama bin Laden -- went on trial in October on charges they were involved in the foiled plot for the attack.

They were sentenced to prison terms ranging from one to nine years.

------

Associated Press writers John Leicester and Angela Charlton contributed to this report.