A manhunt was under way after the killer opened fire at around 8pm (1900 GMT) on one of the city's busiest streets, sending crowds of evening shoppers fleeing for safety.
Soldiers patrolling the area as part of regular anti-terror operations exchanged fire with the suspect and wounded him, but could not stop him escaping, police sources said.
|Shortly after the shooting, lines of police vehicles and ambulances streamed into the market area, under festive lights declaring the city the "capital of Christmas" (AFP)|
Interior Minister Christophe Castaner said early Wednesday the gunman had killed three people and wounded 12. Earlier Mayor Roland Ries had given a toll of "four dead and a dozen wounded".
Castaner also said France had raised its security alert level to "emergency attack" with "the implementation of reinforced border controls and tightened controls on all Christmas markets in France to avoid the risk of a copycat" attack.
The gunman has been identified and was on a watchlist of suspected extremists, a statement from local security services said.
France's security forces, already on high alert after a series of terror attacks since 2015, are particularly stretched at the moment due to anti-government protests that have swept the country.
"I heard shooting and then there was pandemonium," one witness, who gave his name as Fatih, told AFP. "People were running everywhere."
He said he had seen three people injured on the ground only a few metres (feet) from the giant Christmas tree in the centre of the city.
Shortly after the shooting, lines of police vehicles and ambulances streamed into the market area, under festive lights declaring the city the "capital of Christmas."
"We heard several shots, three perhaps, and we saw people running," one witness told AFP, asking not to be named.
"One of them fell down, I don't know whether it was because she was tripped up or if she was hit," the witness said.
President Emmanuel Macron held a crisis meeting with cabinet officials in Paris shortly after midnight.
- Known to police -
Two separate security sources told AFP on condition of anonymity that the shooter was believed to be a 29-year-old from the city, whose name was given as Cherif, and who was set to be arrested on Tuesday morning.
He was being investigated over an attempted murder, one of the sources said.
Several areas neighbouring the Christmas market were sealed off on Tuesday night and residents were being told to stay indoors.
Many people took refuge in local restaurants and bars which pulled down their shutters.
"We let everyone inside, down into the wine cellar. They're locked in there," local restaurant owner Mouad, 33, told AFP.
A police source, again speaking on condition of anonymity, said security forces had opened fire in an area of the city where the suspect was thought to be hiding.
The source did not give the address and it was unclear if the shooter had been located.
Specialist anti-terror prosecutors have opened an investigation into the incident in Strasbourg, which lies on the border with Germany.
Several residents of the city have been detained in recent years for trying to reach jihadist groups in Syria, or have been arrested upon their return.
"Shocked and saddened by the terrible attack in Strasbourg. My thoughts are with all of those affected and with the French people," British Prime Minister Theresa May wrote on Twitter.
- Tourist attraction -
The Strasbourg-based European Parliament was also on lockdown, with MEPs, staff and journalists unable to leave the building.
In a parliament bar usually reserved for MEPs, EU commissioners, powerful legislators and staffers huddled in small groups waiting for developments.
"Our first thought was for colleagues who had already made it to the centre of town, who are safe," Belgian MEP Kathleen Van Brempt told AFP. "Now we just wait."
The Christmas market in Strasbourg and the city's illuminations are an annual attraction that draws hundreds of thousands of people.
Security has been stepped up in recent years after a series of attacks in France by Islamist gunmen and the Strasbourg market was long considered a possible target.
In 2016, a 23-year-old Tunisian killed 12 and injured 48 others when he ploughed a truck into a Christmas market in Berlin in an attack claimed by the Islamic State group.
Special anti-terror army units have been deployed in Strasbourg, and soldiers and armed police are regularly seen patrolling among the 300 wooden Christmas market chalets.
Three years after groups of jihadists gunned down and blew up 130 people in Paris on November 13, 2015, French counter-terror officials say their focus has shifted.
Rather than coordinated attacks, their main concern is attacks by "lone wolves" -- self-radicalised individuals acting without links to terror groups such as Islamic State.
Most recently a 20-year-old Chechnya-born man went on a knife rampage in central Paris last May, killing one man and injuring four other people on a Saturday night.
A total of 246 people have been killed in terror attacks in France since 2015, according to an AFP toll. (AFP)