In a development that should surprise absolutely no one who has been paying attention to how bureaucracies operate, British Sikh activist Jagtar Singh Johal has been released from a Delhi prison - but only after the Indian high court warned the government it would be found in contempt of court for ignoring an 18 September order granting him bail. Johal had been incarcerated for nine years without any full trial, which is a long time to wait for a court date, even by judicial system standards.

The court order came after Johal's lawyers filed a writ of habeas corpus alleging he was being detained against the express direction of the court, which is a fancy legal way of saying "you can't just ignore a judge." The nine-year detention on alleged terrorist offences has been a source of diplomatic tension between the UK and India, with campaigners claiming the British government has not been active enough to secure his release or, failing that, an actual trial. Reprieve says the case never reached full trial largely because the Indian government couldn't assemble credible witnesses to back their claim that Johal transported £3,000 to France to fund a multinational extremist plot involving targeted killings in the Punjab in 2016-17.

On Thursday morning, the high court in Delhi instructed the Indian government to release Johal by 2.30pm Indian time, giving officials a generous three-hour window to comply or risk contempt proceedings. He was ultimately released in the late afternoon wearing a red T-shirt, greeted by friends, family, and flowers - presumably the flowers were not from the Ministry of Home Affairs.

Documents shown to the court by Johal's lawyers on behalf of his father-in-law as petitioner revealed that messages from the prison to the Ministry of Home Affairs seeking permission for his release had been left unanswered. His lawyers stated in their petition that he had met all bail conditions yet "the detainee has nevertheless not been released, and is being held in custody without the authority of any court, pending a 'clarification' sought by the jail from the Ministry of Home Affairs." The petition added that no clarification was forthcoming, noting: "Every day of such detention is a continuing violation of the detainee's fundamental rights under article 21 of the constitution of India." Which is the legal equivalent of pointing out that water is, in fact, wet.

Johal has been detained since 4 November 2017. He faces eight charges of terrorism in the federal court, though a Punjab court cleared him of largely similar charges. He claims any initial confessions were extracted under torture. The bail terms imposed last week included 11 conditions: surrender of passport, a personal bond of 500,000 Indian rupees (£3,930) with two sureties, fortnightly reporting to the investigating officer, prior intimation of any change of residence, and a ban on travelling to the Punjab. He was also restricted from talking to media about the case directly or indirectly.

The Indian government has alleged the Khalistan Liberation Force undertook the killings and that Johal had "complete knowledge of the conspiracy" and was a KLF member.

His Dumbarton-based brother Gurpreet Singh Johal said: "There have been so many setbacks and disappointments in the last nine years that I didn't dare to believe it until I saw Jagtar walking out of the prison gates with my own eyes. The last two weeks have been torture - knowing that Jagtar had been granted bail, but the authorities were refusing to let him out. I'll sleep well tonight, knowing that he's not behind bars. Tomorrow morning, the fight continues, because he's still on trial and facing the death penalty for something he didn't do, trapped in a sham legal process designed to punish him for standing up for human rights."

Reprieve's deputy executive director, Dan Dolan, said: "While tonight is the first night in almost nine years that Jagtar Singh Johal is not caged in a prison cell, he still has the threat of a death sentence hanging over him. It should also be noted that, despite bail being ordered, the prison refused to release Jagtar until his family brought a habeas corpus petition and a judge warned the jail they'd be found in contempt of court."

The UK Foreign Office is understood to have been supporting recent calls for his release on bail after last week's court order, as have two campaign groups in the UK, Redress and Reprieve. Because nothing says "support" like waiting until a court threatens contempt before doing anything.