Rapper Tekashi 6ix9ine was ordered immediately freed from a Manhattan federal lockup four months early Thursday (Friday NZ time) by a judge who cited his asthma and the greater danger he would face behind bars during the coronavirus outbreak.

US District Judge Paul A. Engelmayer made the ruling a day after telling lawyers on both sides that he intended to do so. He cited "a raging and virulent pandemic that has entered federal prisons in New York City." Prosecutors did not oppose the action.

"In light of the heightened medical risk presented to Mr. Hernandez by the Covid-19 pandemic, there are extraordinary and compelling reasons to reduce Mr Hernandez's sentence," he said.

GETTY IMAGES Tekashi 6ix9ine's asthma made him vulnerable behind bars, a judge ruled.

Last week, the judge said he would have sentenced the 23-year-old performer, whose real name is Daniel Hernandez, to home confinement rather than prison when he announced the sentence in December had he known then of the coronavirus.

READ MORE:

* 30% hit: NZ among worst affected economies

* School sent out false virus tips

* Govt offered mags for a dollar

* Lockdown could go on, and on

Engelmayer ordered the release the same day that he asked lawyers to advise what should be done after a former associate of Tekashi 6ix9ine was released from jail because of the coronavirus threat might have put himself in danger outside bars.

The judge said a video of Kintea McKenzie, who pleaded guilty in the case and was awaiting sentencing, "appears to reflect Mr McKenzie partying in very close proximity to numerous others".

Engelmayer said he was concerned because the activity might reflect a violation of McKenzie's terms of pre-sentence release and because "the conduct depicted on the video suggests a complete lack of concern by Mr McKenzie for avoidance of contagion of himself and others".

For Tekashi 6ix9ine, testimony against members of the Nine Trey Gangsta Bloods gang earned him leniency from charges that could have subjected him to a mandatory minimum 37 years in prison for crimes that included orchestrating a shooting in which an innocent bystander was wounded.

The rapper is serving his sentence in a private jail because he co-operated with prosecutors and because the government has control of him as a co-operator.

He was expected to be released July 31. He will be subject to electronic monitoring until he is released from home confinement. Until then, he can visit only his lawyer or a doctor. His lawyer said he was diagnosed in October with bronchitis and sinusitis.

In 2018, Tekashi 6ix9ine had a multiplatinum hit song, "Fefe", with Nicki Minaj, which peaked at No 3 on the pop charts, and "Stoopid", featuring imprisoned rapper Bobby Shmurda.

Key information: Sign up to get Stuff's daily coronavirus situation report email newsletter. It's a quick summary of the essential updates from New Zealand and around the world on Covid-19.