Metz public prosecutor Christian Mercuri said the man in Sunday's incident, who was known to police both “for his radicalisation and for a personality disorder”, shouted “Allah akbar” (God is greater) before being shot.
A police source told AFP he threatened officers when they arrived on the scene and that they fired shots to overpower him.
“He is injured but his life is not in danger,” the source said, adding that no-one else was hurt.
The 22-year-old man who killed a man and injured two women when he ran amok on Friday in a park in the Paris suburb of Villejuif, was also said by witnesses to have shouted “Allah akbar”.
Those stabbings are being treated as a terror attack.
Mercuri said he was in discussions with terrorism prosecutors about whether they should also take charge of the investigation in Metz.