Former Channel Seven presenter Andrew O'Keefe is being sent to a rehabilitation facility for up to a year after being granted bail by the NSW Supreme Court.
Mr O'Keefe had been held in custody since his arrest in January for allegedly assaulting and choking a woman at a Sydney CBD apartment.
After several previously unsuccessful bail applications, Justice Robert Hulme ruled the former TV star be released to treat his "significant descent into an erratic and chaotic lifestyle".
As part of his release conditions, Mr O'Keefe must check straight into a drug and alcohol rehabilitation centre in Swan Bay, north of Sydney.
His brother, Phillip O'Keefe, will pick him up from Dawn de Laos Correctional Centre at Silverwater and make the two-and-a-half-hour drive.
The ex-game show host has pleaded not guilty to a series of charges after police accused him of attacking a woman at his city apartment on January 25.
The former ambassador for anti-domestic violence charity White Ribbon claims he was acting in self-defence.
Dressed in prison greens and with a shaved head, Mr O'Keefe said "thank you, your honour" after Justice Hulme granted him bail with strict conditions.
They include being banned from consuming alcohol or illegal drugs, finishing his rehabilitation course and not contacting the alleged victim.
Justice Hulme said he believed rehab would help him address his "significant descent into an erratic and chaotic lifestyle foreign to what he has experienced well into his adult years".
The judge said Mr O'Keefe had long struggled with mental health issues and that rehabilitation was a "good opportunity" for him.
The court heard he has been to rehab nine times in attempts to overcome addictions to cocaine and ice.
The former Weekend Sunrise host was most recently refused bail in March after Justice Wright ruled that a proposed three week stint in rehab was inadequate.
Mr O'Keefe has pleaded guilty to one charge of possessing 1.6 grams of cannabis and is awaiting sentencing.
He is due before the Downing Centre Local Court next month.
After 17 years with Channel Seven, Mr O'Keefe was dumped from the network at the beginning of last year.