A Long Beach woman who drew widespread condemnation for screaming insults and lobbing racist abuse at her neighbors will have to undergo substance-abuse treatment and stay out of trouble for two years if she wants to avoid criminal charges, a judge ruled Tuesday.

Video of 59-year-old Lorrene Mae Lake went viral last year after high-profile Instagram and TikTok accounts started spreading clips posted online of Lake blasting music, acting erratically, calling her neighbor the N-word and saying the neighbor should be hung.

Neighbors had sought a restraining order against Lake in June, and shortly after the videos went viral, police arrested her on suspicion of violating the order.

Lake’s behavior drew condemnation from District Attorney George Gascón, who called it a hate crime.

“The victims were subjected to criminal threats motivated by hate at their own home for months,” he said as his office announced they were charging Lake with six counts of felony criminal threats, one felony count of violating civil rights, and six other misdemeanor charges as a result of her arrest last year.

Lake has been jailed in lieu of $345,000 bail ever since, but in January she filed for mental health diversion, which allows a judge to set aside the case against her and order her into treatment instead.

Prosecutors say Lake’s case could be dismissed if she completes the terms of her two-year diversion program, which court records show include at least six months of substance-abuse treatment, staying away from her neighbors and their homes, complying with a plan for mental health treatment, abstaining from use of alcohol and drugs, and remaining in her treatment program’s housing.

Prosecutors said they objected the motion, but the judge ultimately ruled against them.

Lake’s attorney did not immediately respond to a request for comment.

Proposal to transfer Queen Mary to the port is dead, officials say