A teenage girl has been jailed in Germany for stabbing a police officer on the orders of Isis militants.

Safia S, a dual German and Moroccan citizen, was 15 when she launched the attack – the first of its kind in the country – at Hanover’s central railway station in February.

The defence argued that she lacked the capacity to know what she was doing, but a court in the northern city of Celle convicted her of attempted murder, helping a terrorist organisation and grievous bodily harm. Her lawyer said he would appeal the six-year prison sentence, which he called “unquestionably high”, at the federal high court in Karlsruhe.

The main railway station in Hanover, Germany (EPA)

Prosecutors said Safia S travelled to Istanbul in January last year, where she met members of Isis who planned to help her enter territory it controlled in Syria. Her 18-year-old brother had been jailed weeks earlier after being caught by Turkish authorities at the Syrian border, where he was suspected of attempting to join Isis.

After meeting extremists, Safia received orders to carry out a “martyrdom attack” in Germany, where investigators believe she was radicalised. In 2008, aged just seven, she appeared in a video with the German Islamist preacher Pierre Vogel, who praised her as “our little sister”.

The state domestic intelligence agency started investigating her for preparing a serious crime in 2014, while Germany's NDR television uncovered an online chat from the day after the Paris attacks where she described it as the “happiest day of my life”, adding: “Allah bless our lions”.

As Safia’s radicalisation became more evident, her grandmother called the police, Deutsche Welle reported, and authorities met with the family days before she left Germany for Istanbul on 22 January.

Police chief says Germany 'on high alert' after attack

The teenager’s mother reported her missing and went to Turkey to find her, before she returned in February to be greeted by police at Hanover airport. But she was not detained and on 26 February, she launched her attack at Hanover train station after filming a video of herself pledging allegiance to Isis.

“The accused armed herself with a vegetable knife and a steak knife and went to the main train station,” prosecutors said.

During an identification check, Safia “unexpectedly drew her vegetable knife and stabbed the police officer in the back of his neck”. He suffered severe injuries but survived after undergoing surgery.

The girl's father, identified only as Robin S according to German privacy laws, told the RedaktionsNetzwerk (RND) that prosecutors carried out a “show trial” against his daughter because she was Muslim.

Berlin Christmas market lorry attack Show all 18 1 /18 Berlin Christmas market lorry attack Berlin Christmas market lorry attack Several people have been killed after a lorry drove into crowds at a Christmas market in Berlin REUTERS/Fabrizio Bensch Berlin Christmas market lorry attack 'At least nine' people have been killed and more than 50 injured. AP Berlin Christmas market lorry attack Emergency Services rush a Berlin market victim to an ambulance Associated Press Berlin Christmas market lorry attack Police cordoned off the square at Kaiser Wilhelm Memorial Church following the incident REUTERS Berlin Christmas market lorry attack Rescue workers inspect the lorry that crashed into a Christmas market close to the Kaiser Wilhelm memorial church in Berlin EPA Berlin Christmas market lorry attack Emergency crews inspect the lorry that ploughed into a Berlin Christmas market, killing at least nine people AFP Berlin Christmas market lorry attack Fire crews attend the scene of the attack AFP/Getty Berlin Christmas market lorry attack Armed police secure the site of a lorry attack at a Christmas market in Berlin REUTERS Berlin Christmas market lorry attack Crushed debris is visible beneath the wheels of the vehicle REUTERS Berlin Christmas market lorry attack An injured man is pushed to an ambulance REUTERS Berlin Christmas market lorry attack Medics attend an injured person after the lorry attack which killed at least nine and injured more than 50 people AFP/Getty Berlin Christmas market lorry attack Firefighters examine the lorry which was rammed into a Berlin Christmas market REUTERS Berlin Christmas market lorry attack A person is carried into an ambulance REUTERS Berlin Christmas market lorry attack View of the lorry that crashed into a Christmas market in Berlin, killing at least nine and injuring at least 50 people AFP/Getty Berlin Christmas market lorry attack Rescue workers push a person on a stretcher to an ambulance Getty Berlin Christmas market lorry attack Firefighters assess the damage after the lorry rammed the Christmas market, killing 'at least nine', and injuring more than 50 people AP Berlin Christmas market lorry attack Firefighters stand beside a toppled Christmas tree at the site of the suspected terrorist attack in a Berlin Christmas market AP Berlin Christmas market lorry attack Damaged stalls at the scene of the incident at a Berlin Christmas market where at least nine people have been killed EPA

“If she had been a punk, she would have got a maximum of two years,” he added, claiming his daughter regretted her actions and deserved another chance. “You couldn't tell anything. She was normal, like always,” he told RND. “She wore a head scarf, but she was also a fan of Justin Bieber and played football.”

A 20-year-old German-Syrian man, named only as Mohamad K, was sentenced to two-and-a-half years in prison as an accomplice after failing to inform police despite knowing of Safia's plan.

The trial, which started in October, was controversially held behind closed doors to protect the defendant from “continued exposure and the related stigma”.

Safia’s attack came months before the Würzburg train attack, the Ansbach suicide bombing and the Berlin Christmas market attack, which were all claimed by Isis.

She initially told police the stabbing was spontaneous and the evidence of Isis instructions was not found until March, making it the first terror attack commissioned by the group in Germany.