SACRAMENTO, Calif. (AP) – A divided California Assembly has approved legislation prohibiting for-profit corporations from operating charter schools in California.

The bill by Assemblyman Roger Hernandez, a Democrat from West Covina, drew heated debate between Democrats and Republicans on the Assembly floor Thursday.

It’s a watered-down version of legislation backed by the California Teachers Association that would have required school districts to appoint a majority of charter school board members. Charter school supporters vigorously opposed the bill.

Hernandez said it was intended to prevent private charter schools from taking public school funding to help out-of-state companies. Only six of the nearly 1,200 charter schools in California are run by a for-profit company.

Lawmakers approved AB787 on a 42-25 vote, sending it to the Assembly.