The gunman, known to security services, is on the run and is being hunted by police. He had been injured in an exchange of gunfire with a soldier, police said.
The shooting happened close to a Christmas market in one of the central squares, Place Kléber.
France's counter terrorism prosecutor has opened an investigation.
Confirming the death toll had risen to two, the French interior minister, Christophe Castaner, who is on his way to the city, called it a "serious public security incident".
Seven of the injured are said to be in a serious condition.
Police said the suspect was already known to the security services as a possible terrorist threat.
According to France's BFM TV the man had fled his apartment in the Neudorf district of the city on Tuesday morning as it was being searched by police in connection with a robbery.
Grenades were found during the search.
Residents in Neudorf have been urged to stay indoors amid unconfirmed reports he has been tracked down and cornered by police in the area.
The European Parliament, which is nearby, is currently in lockdown. The parliament's president, Antonio Tajani, tweeted to say it would "not be intimidated by terrorist or criminal attacks".
Read More (...)