A 16-year-old girl has been charged with attempted murder and supporting a terrorist organisation by German federal prosecutors.

The teenage German-Moroccan citizen is accused of acting on behalf of the so-called Islamic State (IS) when she seriously wounded a police officer with a kitchen knife at Hanover's central railway station on February 26.

The girl, who was arrested at the scene of the attack, is also being charged with committing serious bodily harm.

Prosecutors said in a statement that they also are charging a 19-year-old German-Syrian man with failing to prevent the attack.

They say Mohamad Hasan K knew the girl was planning to carry out a "martyrdom operation" in Germany on behalf of IS.