Probation is possible only after he has completed at least two thirds of the prison sentence. Ahmed H was also expelled from Hungary for 10 years.

The procedure held in the southern Hungarian city was a retrial after a judge ruled that available evidence had not been assessed properly in the first trial.

The prosecutor, Ferenc Szanka, proposed a sentence of just under seventeen and a half years. He also proposed that the court should uphold the original decision to permanently expel the Syrian from Hungary.

The prosecutor insisted that a telephone seized from Ahmed H, who had lived in Cyprus before his arrest, included recordings linked to terrorist organisations. The authorities in Cyprus said he was a dangerous religious fanatic, he added.

Ahmed H’s defence lawyer told the court it should consider charges of attempted violence against an official rather than terrorism. He also noted the defendant had served a substantial length of time in pre-trial detention and this should be considered as time served. Péter Barandy insisted the defendant had thrown stones at police on the Hungarian border “out of desperation” and in a state of restricted judgement.

He said the Syrian man had held a passport, making him eligible to cross at any border station, but instead he had chosen to accompany his parents, his brother and his children who lacked them.

Barandy asked the court to drop charges of attempted illegal border crossing against the suspect, arguing that he had valid documents.

The trial was held under special security measures and the defendant was handcuffed and in leg chains. A civil activist in the courtroom wore a “Free Ahmed H now” badge.

In the first-instance ruling by the Szeged court in November 2016, Ahmed H was sentenced to ten years in prison for terrorist activities involving illegal border crossing as well as incitement to violence in the context of a riot.

As part of his conviction, Ahmed H was sentenced for using a megaphone to direct migrants who were hurling rocks at police on the Hungarian border.

The prosecution appealed for a graver, the defence for a lighter sentence. The court ruled that Ahmed H should remain in custody.

Amnesty International said that the ruling was a “mockery of justice”. In a statement, the organisation said that all charges against Ahmed H should be dropped in an appeals procedure and he should be released immediately. According to the statement, while the Syrian defendant had acted to help his family he was presented “both in the court and outside” as a criminal, but “there is no conclusive evidence that he committed terrorist activities”. “His case is an example for the misinterpretation of anti-terrorism laws,” they added.