Chris Brown
Singer Chris Brown appears for a probation progress hearing at the Clara Shortridge Foltz Criminal Justice Center in Los Angeles, Calif., Feb. 3, 2014. Reuters/David McNew/Pool

Chris Brown was ordered by a California judge Friday to remain in an anger-management rehab program for the next two months.

According to the rehab facility, Brown’s behavior is being linked to bipolar disorder and post-traumatic stress disorder (PTSD). The singer appeared in court to attend a progress hearing in the assault case related to Rihanna.

"Mr. Brown will also require close supervision by his treating physician in order to ensure his bipolar mental-health condition remains stable. It is not uncommon for patients with post-traumatic stress disorder and bipolar II to use substances to self-medicate their biomedical mood swings and trauma triggers," read a letter from the facility obtained by E! News.

"Mr. Brown became aggressive and acted out physically due to his untreated mental-health disorder, severe sleep deprivation, inappropriate self-medicating and untreated PTSD," the document reportedly read.

Superior Court Judge James Brandlin scheduled Brown’s next hearing for April 23, which is expected to come after a brief assault trial in Washington, earlier that month.

According to reports, after the assault trial, the court will decide whether Brown will be facing a jail term.

According to E! News, a probation report stated that Brown had completed 250 hours of community service and had a remaining balance of 750 hours.

The report also states that Brown "would like to inform the court that he appreciates what he has learned in the rehabilitation facility, as it has allowed him to change his life for the better," and that "he remains thankful to the court for the opportunity to find out and learn about himself, his anger issues and the type of person he wants to become, which is a man who is able to better himself and be a positive role model."

Brown, who reportedly was upset with the court decision, wrote on his Twitter account on Friday: “Never really goes the way u plan. #LIFE.”