Up to 4,000 prisoners in England and Wales are to be released in an effort to control the spread of coronavirus, the Ministry of Justice has said.
Inmates with two months or less still to serve will be released on temporary licence in stages.
The selected low-risk offenders will be electronically tagged and can be recalled at the first sign of concern.
It is seen as a way to avoid thousands of prisoners - many of whom share cells - becoming infected.
Across 29 jails, 88 prisoners have tested positive for the virus with a further 1,200 believed to be self-isolating.
Sex offenders and those convicted of violent or sexual offences, as well as anyone who is a national security concern or a danger to children, will not be considered for release, the Prison Service said.
No inmate convicted of Covid-19-related offences - including coughing at emergency workers or stealing personal protective equipment - will be eligible either, said the Ministry of Justice (MoJ).
Lord Chancellor and Justice Secretary Robert Buckland QC said: "This government is committed to ensuring that justice is served to those who break the law.
"But this is an unprecedented situation because if coronavirus takes hold in our prisons, the NHS could be overwhelmed and more lives put at risk."
The MoJ also said no prisoners with symptoms of coronavirus would be released, nor would those who do not have housing and health support in place.
Mr Buckland previously announced that pregnant inmates could be granted temporary release to protect them and their unborn children from coronavirus.
Mothers behind bars with their children who pass the same checks could also be released, he said.
The legislation for the measures is expected to be put in place on Monday.
The prisons union welcomed the news but raised concerns over staff pressure.
About 8,000 prison staff have been absent due to issues related to Covid-19, around a quarter of the total workforce.
Ian Lawrence, general secretary of trade union Napo, said its members working in the National Probation Service and in community rehabilitation companies were "already over-stretched".
"Probation providers must work to ensure this new cohort can be supervised safely and not cause additional operational pressure and stress to the workforce," he added.
In Northern Ireland, up to 200 offenders are being let out early and the Scottish government is considering similar measures.
France has also announced plans to release 5,000 prisoners early, along with 3,500 in the US state of California.
Australia, Germany, and Canada have already given the go-ahead for the early release of prisoners.
Analysis by Danny Shaw, Home Affairs correspondent
This is the last thing Boris Johnson's government ever wanted to do.
In their general election manifesto, the Conservatives promised criminals would be "kept off our streets". Since then, a series of measures have been announced to ensure those convicted of the most serious crimes - including terrorism - stay behind bars for longer.
So an emergency early release scheme, which means that almost 5% of the prison population of England and Wales will be let out before they've even reached the halfway point of their sentence, was not an easy decision for Number 10 to make.
More politically palatable options were considered, such as transferring prisoners to army bases and immigration removal centres, but they are fraught with practical difficulties.
The danger for the government of this scheme - the largest since 80,000 offenders were let out early as part of Labour's End of Custody Licence programme between 2007 and 2010 - is that some of those released will commit further, possibly horrendous, crimes.
Ultimately, ministers decided the alternative - infected prisoners overwhelming hospitals - was even worse.