SACRAMENTO -- Legislation that requires all juvenile sex offenders to get treatment and strengthens penalties for young perpetrators who bully their victims online cleared a crucial committee Tuesday.

But the bill won unanimous support from the Assembly Public Safety Committee only after the San Jose lawmaker who sponsored the measure agreed to delete a key piece of the proposal that many juvenile justice advocates opposed.

Democratic Sen. Jim Beall sought to mandate that youths who sexually assault unconscious or developmentally disabled victims serve at least two years in a juvenile detention facility. Under current law, that crime is considered less serious than forcible rape.

Instead, Audrie's Law would require all young people who commit sex crimes to get treatment. But juvenile court judges would have broad discretion to tailor the treatment to each offender, depending on the seriousness of the crime and the victim's vulnerability.

"This is a step in the right direction," said Sheila Pott, the mother of the sexual assault victim whose case inspired the proposal. "We're thrilled to see the bill get out of committee, but we're disappointed that we had to remove any type of minimum sentencing for these offenders."

Senate Bill 838 is named for 15-year-old Saratoga High School student Audrie Pott, who killed herself in 2012 after being sexually assaulted by three classmates who photographed her half-naked body during the attack and then shared the images with friends.

Supporters of the proposed mandatory minimum sentence said it was needed because Audrie's attackers got light punishments of 30 to 45 days -- and got to serve their time on weekends. But juvenile justice advocates called the mandatory minimum sentence prescriptive and punitive.

Despite the compromise, Beall said he still sees a need to punish teenage rapists who prey on victims who can't fight back. He said he plans to take on that issue again next year.

"There should be a middle ground between adults and children," Beall said. "Some of these sociopathic characters just happen to be 17, and they deserve both punishment and treatment."

Beall said he knew from the start that his bill would have a tough time clearing the Assembly Public Safety Committee, which is chaired by ultraliberal Assemblyman Tom Ammiano, D-San Francisco, even after the proposal won the unanimous support of the Senate several weeks ago.

Ammiano, who has long had an interest in juvenile justice issues, reportedly told other Democrats on the committee to oppose the bill unless the mandatory minimum sentence requirement was removed. A committee vote planned for last week was rescheduled so Beall and Ammiano could strike a deal.

"But the chair is retiring this year, and next year is another day," Beall said of the chances of a tougher bill passing in the future.

The legislation also allows prosecutors to seek harsher sentences for sex offenders who take pictures of their crimes and use the images to harass, bully or intimidate victims. It also requires that court cases involving juveniles who sexually assault unconscious people be open to the public.

Because juvenile court records are sealed, it's impossible to know the reasoning behind the light sentences handed down to Audrie's attackers.

Failing to win justice for Audrie, however, isn't a good reason to change a juvenile justice system that's largely working well, said Sue Burrell, an attorney for the San Francisco-based Youth Law Center, which advocates for juveniles' rights.

"Maybe there were problems with proof in this case. Maybe the district attorney was limited in what he could get because the case was weak," Burrell said. "Those kids who got weekends for doing a very serious crime could have been tried as adults under current law. We don't really know what happened."