Safia S
Policemen stand in front of the Higher Regional Court in Celle near Hanover, northern Germany, for the verdict of Safia S on 26 January 2017 Holger Hollemann/AFP/Getty Images

A 16-year-old girl who knifed a German policewoman after being ordered to carry out a "martyrdom attack" by the Islamic State (Isis) has been jailed for six years.

The girl, who can only be identified as Safia S under German privacy regulations, was convicted of attempted murder and being a supporter of a foreign terrorism.

The defendant, who was just 15 at the time, appeared at a regional court in the northern city of Celle, which heard how she launched the surprise attack at Hannover's main train station in February 2016.

The German-Moroccan dual citizen used a kitchen knife to stab the officer, 34, in the neck. The victim survived following an emergency operation lasting several hours.

Safia S was arrested at the scene and admitted to the attack. She admitted that she had travelled to Istanbul in the hope of reaching Syria, and met an Isis operative in the Turkish capital.

The teenage Islamic fundamentalist was brought back to Germany by her mother, but prosecutors believe she had already been tasked to carry out an attack in the event of her return.

Police intercepted chat logs between Safia S and another extremist, who told her to launch a "surprise for the unbelievers".

The 34-year-old officer suffered life-threatening injuries and a federal investigation concluded her act was intended as a "martyrdom operation".

It has been reported that she has written an apology letter to her victim while in custody and her lawyers have stated they will appeal the sentence.

Safia S trial
Veiled women arrive at the Higher Regional Court in Celle for the verdict of Safia S on 26 January 2017. HOLGER HOLLEMANN/AFP/Getty Images

A spokesman for the German Federal police said at the time: "As she was politely pulled to one side to confirm her identity a knife appeared lighteningly quick in her hand and our colleagues had little chance to defend themselves. This was an Islamic attack against our officers. It is a miracle that she survived at all.

"The attacker was ice cold. Her only worry was that her headscarf was rumpled and she wanted to put it straight. It was nothing to her if the police officer lived or died."

Prosecutors said that Safia S belonged to a network of young Isis followers in the German city.

Safia's father, identified as Robin S, told the newspaper chain RedaktionsNetzwerk, that the girl must have become radicalised very quickly. "You couldn't tell anything. She was normal, like always. She wore a head scarf, but she was also a fan of Justin Bieber and played soccer."