Educators in Oklahoma packed the state Capitol this month amid a teacher walkout. (Nick Oxford/Reuters)

Hundreds of teachers at California’s largest virtual charter school just won a landmark union contract from the Virginia-based education giant K12 Inc., securing a hefty pay raise and due process rights. The pact, announced Wednesday, was reached after years of organizing and negotiations — and a threat of a teachers strike this month.

Teachers at the nine independent for-profit California Virtual Academies, known as CAVA, began the effort to unionize and win a contract more than four years ago. Now, they will receive pay raises of nearly 18 percent as well as a schedule for salary raises, caseload caps and binding arbitration.

This is the first time K12, the largest operator of for-profit charter schools in the country, has signed a union contract with its teachers, and the agreement marks one of the first such arrangements in the country. At its high point, CAVA enrollment was about 15,000, with students in most of California’s counties, although the number of students dropped after California’s attorney general announced in 2016 that his office had reached a $168.5 million settlement with K12 and CAVA over alleged violations of California’s false claims, false advertising and unfair competition laws.

California authorities alleged that K12 and CAVA schools provided misleading information to parents about students’ academic progress, parental satisfaction and eligibility for California public universities. The errant information was shared to persuade families to enroll their children, the state said. The state also alleged the company and schools gave inflated attendance numbers to state officials, allowing them to get more state funding than they deserved. K12 did not admit wrongdoing in agreeing to the settlement and said the state never proved its claims.

K12 did not immediately provide a response to the announcement of the pact.

Organizing teachers is difficult, but it is especially tough with online schools, with educators scattered and not routinely congregating. But Brianna Carroll, a high school social science teacher at CAVA who was part of the bargaining unit for the union, said the vast majority of CAVA teachers came to support the union efforts after persistent organizing efforts.

A group of CAVA teachers formed California Virtual Educators United in 2013 and approached the California Teachers Association for help in pursuing a contract with K12. The effort began, but it was not until September 2016 that formal negotiations began. K12 negotiators told the teachers, Carroll said, that they would never get what they were seeking. In the end, they did, she said.

“It changes the culture of our school,” she said. “I think a lot of teachers viewed our schools as a place where you go to until you get a job somewhere else. But this changes it to a place where we believe teachers and students will want to stay. Students will want to graduate from here and go to college. And teachers will want to stay here and possibly even retire from here.”

Carroll said the teachers recently agreed to call a strike this month if they could not reach an agreement with K12. They were inspired, she said, by educators in West Virginia, Oklahoma and other states who have been striking for better pay and improved conditions for students. Many of the CAVA teachers were afraid to strike, she said, concerned about losing their jobs. But, she said, they became “really inspired” by watching other teachers say that demanding better conditions “is more important than the possibility of getting laid off.”

Charter schools are publicly funded but operate independently from traditional school districts. California has more charter schools and charter school students than any other state. The sector has been riddled with problems because of a state charter law that allows the schools to operate with little, if any, accountability or transparency to the public. The powerful charter school lobby has thwarted legislative efforts in California to force more accountability.

K12 is controversial in the education world. A San Jose Mercury News investigation published in April 2016 revealed that K12’s California online charter schools had “a dismal record of academic achievement” but had received more than $310 million in state funding during the past dozen years. Company and schools officials say that their students are often nontraditional students and that it isn’t fair to equate their performance with traditional schools.

K12 is a member of the American Legislative Exchange Council, known as ALEC, a group that advances model legislation about numerous issues, including more than 140 bills to promote private for-profit education models since 2013.