SACRAMENTO — California lawmakers want to bar middle school and high schools from starting before 8:30 a.m., but the final decision on when the first bell should ring will rest with Gov. Jerry Brown.

Following an intense debate over what has been a local school district decision, the Senate and Assembly approved SB328 by Sen. Anthony Portantino, D-La Cañada Flintridge (Los Angeles County).

The bill would require all public middle and high schools to start no earlier than 8:30 a.m., including charter schools, with supporters arguing that research shows teens natural sleep patterns keep them up late and lead to sleep deprivation when schools have early start times. Research shows teens do better in school, have lower rates of depression and anxiety and fewer car accidents when school start times start later.

The bill would be effective in 2021 and would exempt rural school districts.

The bill failed last year in the Assembly in the final days of session after Portantino said the California Teachers Association and California School Boards Association began an aggressive campaign against it. The groups remained opposed to the bill this year.

SB328 cleared the Senate 23-13 on Friday. Earlier Friday, it cleared the Assembly with the bare minimum 41 votes it needed, with 30 lawmakers voting against it.

Opponents of the bill argued that starting school later would make it difficult for working parents to drop off their kids at school and impact extracurricular activities.

“We should not micromanage schools from Sacramento,” said Assemblyman Patrick O’Donnell, R-Long Beach. “Why have a school district if we are going to pass this bill? SB328 will burden working families.”

A legislative analysis of the bill warned that moving school start times would result in “significant local costs for school districts,” particularly those that stagger their start times in order to use the same school buses at more than one school.

The average time middle and high schools start in California is 8:07 a.m., according to the Centers for Disease Control and Prevention.

Assemblywoman Shirley Weber, D-San Diego, said lawmakers should do what the research says is good for kids and ignore arguments about what is convienient for parents. Weber said schools that want to start later are often unable to because school boards are paralyzed by parential pushback.

“We’ve tried everything to help kids and when the data comes back and it says this will help kids … then you ought to at least listen to it,” Weber said.

Melody Gutierrez is a San Francisco Chronicle staff writer. Email: mgutierrez@sfchronicle.com. Twitter: @MelodyGutierrez