Chris Brown appeared in court last Friday (May 9) and he admitted to violating his probation by getting arrested in Washington, D.C. for allegedly assaulting a fan — an admission his legal team is hoping will be the key to his freedom really soon.

The 25-year-old, who spent his birthday earlier this month behind bars, was then sentenced a year in prison, but since Chris gets credit for the 116 days he spent in rehab, plus the 59 days he was behind bars, that leaves only 131 days in the slammer.

Additionally, because of overcrowding, TMZ reports that the L.A. County Sheriff’s Dept. has been releasing inmates sentenced 1 year in prison after just 240 days. Also, Chris will reportedly get credit for 2 days for every 1 day he served behind bars.

After doing the math, he already has credit for 234 days, which is just 6 days shy of 240, meaning that he could released VERY soon.

More from TMZ:

The judge could have gone a lot harder — 4 years in prison. But Chris got a break because the judge took into account he was recently diagnosed with bipolar disorder, which could account for some of the violence.

The judge also ordered Chris to attend therapy sessions with a shrink 2 times a week. And he must submit to random drug testing 3 times a week.

Chris Brown’s D.C. assault trial is set to start in the coming months, so Chris isn’t completely out of the legal woods just yet.

Brown’s lawyer said Friday’s resolution is obviously a huge relief for the singer, who has been locked up for the past two months.

“We’re gratified that he was not sentenced to state prison, gratified that he’s still on probation,” Mark Geragos said, according to CNN. “I think that Chris has learned quite a bit through this experience and I’m anxious to see how he does, as I think everybody else is.”

Be the first to receive breaking news alerts and more stories like this by subscribing to our mailing list.