A judge has cleared the way for Lindsay Lohan's release from jail on $300,000 (£189,609) bail after the actress challenged a ruling earlier in the day that would have kept her in jail for nearly a month.
Los Angeles Superior Court Judge Patricia Schnegg set the amount on Friday evening after Lohan's attorney, Shawn Chapman Holley, filed a late-afternoon appeal seeking bail for the star.
Mr Holley had been prohibited from arguing for bail during the Friday morning hearing when Judge Elden Fox ordered the starlet held until an October 22 hearing.
Judge Schnegg imposed several restrictions on the actress's release, including that she must wear an alcohol-monitoring bracelet, which must be in place within 24 hours of her release. It is unclear when the Mean Girls star could be released.
As conditions of bail, Lohan is also prohibited from possessing any controlled substances, must refrain from drinking and must stay out of places where alcohol is primarily sold.
Judge Schnegg's ruling states that defendants are entitled to bail in misdemeanour cases, which applies to Lohan.
District Attorney's spokeswoman Sandi Gibbons said prosecutors did not oppose the star's motion to seek bail.
The actress was whisked from the Beverly Hills court on Friday morning and was at the facility for about eight hours when the order clearing her release was issued.
Judge Fox's decision to jail Lohan came after the star failed a court-ordered drug test after being released from rehab last month.
Lohan remains in an isolation unit of a women's jail in suburban Los Angeles, where she spent 14 days after a previous judge determined she violated the terms of her probation.