The Home Office has released almost 300 people from detention centres in the last few days because of the Covid-19 pandemic, the Guardian has learned.

The speed and scale of the release is unprecedented in recent years. Detainees and charities estimate that more than a quarter of those currently locked up have been set free.

The release comes in the wake of a legal action launched last week which argued that the Home Office had failed to protect immigration detainees from the coronavirus outbreak and failed to identify which detainees were at particular risk of serious harm or death if they do contract the virus due to their age or underlying health conditions.

It called for the release of all those who are particularly vulnerable and for all detainees to be tested, along with the suspension of all new detentions. The action warns even a short delay could have “catastrophic consequences”.

It is believed that more than 900 people are currently in immigration detention.

The Home Office provided a response to the legal action to the high court out of hours on Friday. After receiving the Home Office submissions, Mr Justice Swift made an order on Friday night that a half-day hearing should be held next Wednesday to determine whether or not to grant the emergency measures requested in the legal challenge by the charity Detention Action and a vulnerable detainee who suffers from hypertension, which experts say doubles the risk of death if Covid-19 is contracted.

As part of the legal action, the public health expert Prof Richard Coker of the London School of Hygiene and Tropical Medicine has provided an expert report warning that prisons and detention centres provide ideal incubation conditions for the rapid spread of the coronavirus, and that about 60% of those in detention could be rapidly infected if the virus gets into detention centres.

Coker’s report was commissioned by Duncan Lewis Solicitors, who have embarked on what is thought to be the first legal action against the government relating to the coronavirus outbreak.

The UK government issued guidance stating that if there was a significant outbreak of Covid-19, “cohorting” should be used to put all those infected together behind locked doors in prisons, detention centres, young offender institutions and secure units.

Many of those in detention have arrived from high-risk countries such as Iran, China and Italy. Some are forced to share rooms, and a “lock-in” regime prevents many from leaving their cells during the night.

Emma Ginn, director of the detention charity Medical Justice, said that those still in detention were scared of contracting the virus.

“We are getting harrowing calls from seriously ill clients describing their fear of the virus spreading in the centres and feeling powerless in response. The distress in their voices is palpable and there is little we can do to console them,” she said.

Bella Sankey, director of Detention Action, said:”Our landmark legal challenge has already forced a response from the home secretary. We are delighted the high court has now ordered a hearing for next week and we’ll be pressing for a robust review of all detentions. In the midst of a global pandemic, administrative detention puts those interned in grave danger. And maintaining detention when the evidence from Prof Coker is that detention centres act as ‘epidemiological pumps’ puts us all at unnecessary risk.”

A Home Office spokesperson said: “Immigration enforcement is responding to the unique circumstances of the coronavirus outbreak and following the latest guidance from Public Health England. This includes providing soap and cleaning materials to all detainees. Decisions to detain are made on a case-by-case basis and kept under constant review, but our priority is to maintain the lawful detention of the most high-harm individuals, including foreign national offenders’’