The suspect was said to have entered central Strasbourg via the Corbeau bridge to the south of the city centre, before heading to Rue des Orfevres, a popular shopping street close to the cathedral, where he opened fire.
Castaner said the gunman had killed three people and wounded 12.
Soldiers patrolling the area as part of regular anti-terror operations exchanged fire with the suspect and wounding him, but could not stop him escaping, police have told local media.
Members of the elite French police unit BRI stand on the Pont de l'Europe (Europe bridge), crossing the border with Germany over the river Rhine in Strasbourg, on December 12, 2018, as part of searches in order to find the gunman who opened fire near a Christmas market the night before, in Strasbourg, eastern France.
Nunez said the suspect had a police record and had been in jail several times, most recently at the end of 2015.
Anadolu Agency via Getty Images The attack revived memories of a new millennium terror plot targeting Strasbourg's Christmas market. "More information to come, follow the instructions of the authorities". Around half of those wounded are seriously injured.
Local authorities tweeted for the public to "avoid the area of the police station", which is close to the city's Christmas market.
A shopkeeper told BFM TV: "There were gun shots and people running everywhere".
Freelance journalist Camille Belsoeur said he was at a friend's apartment on the same street and at first mistook the gunfire for firecrackers.
Reporter's Notebook: Riots in Paris streets ahead of Macron address
So a group of a few hundred took side streets and tried to get past a police barricade, and police fired back with tear gas. Several tourist sites, including the Eiffel Tower and Louvre Museum, were closed at the weekend.
Stephen Curry doesn't believe we've landed on the moon
Irving found himself apologizing months after he claimed that the Earth is flat. "What's going on with our world?!'" he said. I think what we're learning here is that National Basketball Association players are huge fans of conspiracy theories.
CDC: Say no to raw cookie dough
When used in batter or dough, raw eggs contain Salmonella and can cause people to get sick if consumed raw or lightly cooked. Cookie dough found in products like ice cream have already heated the dough to kill the germs, according to NBC News .
French President Emmanuel Macron, who had attended a crisis meeting with cabinet officials in Paris, later tweeted that the "solidarity of the entire nation" was with Strasbourg, the victims and their families.
Police detained five people in overnight searches around the city, Laurent Nunez, secretary of state for the Interior Ministry, said on France-Inter radio.
A terror investigation has been opened for murder and attempted murder, the French prosecutor's office said. "Let us move on". "After 45 minutes, we stopped the resuscitation effort because a doctor told us over the phone that it is senseless".
Mr Castaner said: "Three hundred and fifty police and gendarmes are now on the ground to apprehend the suspect, supported by two helicopters, the RAID (French anti-terror police), the BRI (anti-gang brigade) and the Sentinel force".
The source did not give the address and it was unclear if the shooter had been located.
Strasbourg resident Yoann Bazard told The Associated Press by telephone he heard "two or three shots" and some screams before he went to a window and saw people running Tuesday night.
Theresa May said she was "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. Strasbourg, on France's eastern border, is home to the European Parliament, one of several places that was locked down after the shooting.
In a parliament bar usually reserved for MEPs, EU commissioners, powerful legislators and staffers huddled in small groups waiting for developments. "Now we just wait".
A suspected extremist is on the run after a shooting which left two people dead near a Christmas market in the French city of Strasbourg.