An ISIS terrorist has lost his test case in which he challenged a new UK terrorism law banning the early release of jailed extremists. The UK changed its law allowing prisoners to be released halfway through their sentences following two attacks by terrorists soon after their release from jail. Mohammed Zahir Khan would have been eligible for automatic release in March prior to the law change. He had been jailed for spreading ISIS propaganda online including a video encouraging a terror attack and had endorsed acts of terrorism, such as murder and martyrdom. The former shopkeeper pleaded guilty in 2018 to five counts of encouraging terrorism, one count of dissemination of a terrorist publication and two counts of stirring up religious hatred. He was jailed for four years and six months. Khan tried to appeal against the UK government's new law on the grounds it was discriminatory and unjust because of the changed nature of the sentence he had been given in court. But two judges at the High Court in London threw out his claim, saying the government's law change was "logical and rational" given the threat to public safety. "In our judgment, it is impossible sensibly to regard a terrorist offender as in an analogous position to an ordinary offender," Mr Justice Garnham said. "The nature of the offending is different, the need for punishment is different, the way the offenders have to be managed in custody is different, the risks they pose on release into the community are different. "Faced with the real and immediate threats to public safety demonstrated by the attacks of November 2019 and February 2020, altering arrangements for the early release of terrorist prisoners was a logical and rational response. "The offending in issue was especially grave, involving as it did random knife attacks on innocent bystanders causing fatal injuries. "Keeping terrorist prisoners in custody for a longer proportion of their sentence, and requiring Parole Board approval before early release, was an entirely legitimate response." The ruling means about 50 prisoners serving sentences for terrorism will be detained for longer. Now offenders jailed for more than two years must serve at least two thirds of their sentence in prison before they can be considered for release by the Parole Board, which will then only release them if they are deemed safe. Northumbria police and crime commissioner Kim McGuinness has praised the decision. "If someone poses a threat to public safety, we absolutely need to keep them off our streets," she said. The UK had reviewed with urgency its scheme following a terror attack last November, which saw Usman Khan kill two prisoner-rehabilitation volunteers at an event near London Bridge. He had been released at the halfway point of his 16-year sentence for plotting to blow up the London Stock Exchange. During the review of the prisoner release scheme, another ISIS extremist committed a separate attack in February. Sudesh Amman stabbed people in a South London street only days after his release from jail.