Police shot and wounded a man armed with a knife after he attacked officers inside a police barracks in eastern France on Monday.

Shortly before the knifeman struck the police facility in Dieuze, near Metz, the local police operations center received warning that an atrocity was to be committed in the name of Islamic State, French news agency AFP quoted the local prosecutor as saying.

"We must relate the facts to a call received by the operational center of the gendarmerie shortly before, in which an individual declared that he was a soldier, that there was going to be carnage in Dieuze and that he was a member of Islamic State," prosecutor Christian Mercuri was quoted as telling a news conference in the area.