Teachers in the nation’s second-largest school district will strike Monday after the United Teachers Los Angeles and educators failed to reach a last-ditch bargaining agreement on higher wages and class sizes.

United Teachers Los Angeles previously said its 35,000 members would walk off the job Thursday for the first time in 30 years if a deal wasn’t reached on higher pay and smaller class sizes. However, a judge was considering Wednesday whether the union gave legally proper notice of a strike and could have ordered teachers to wait. Union officials said they believe they would have prevailed in court but decided to postpone a strike to avoid confusion and give teachers, parents and others time to prepare.

The Los Angeles Unified School District, with 640,000 students, stated the delay provides an opportunity to keep talking and avoid a strike. Teachers are hoping to build on the “Red4Ed” movement that began last year in West Virginia, where a strike resulted in a significant raise.

The movement moved to Oklahoma, Kentucky, Arizona, Colorado, and Washington state, spreading from states with “right to work” laws that limit the ability to strike to the more liberal West Coast with strong unions.

“What you’re seeing with unions is real enthusiasm and a belief that you can actually be successful,” said Robert Bruno, a professor of labor and employment relations at the University of Illinois. “The educational sector is rife with deep grievance and frustration, but there’s now a sense that you can actually win.”

The walkouts in other states emboldened organized labor after a critical defeat at the U.S. Supreme Court, which ruled last year that government workers can’t be required to join unions and pay dues.

“Each state is different, but the commonality across all states is teachers, and parents are sick of schools not being invested in,” union President Alex Caputo-Pearl said.

The Los Angeles district has offered a 6 percent raise over the first two years of a three-year contract. The union wants a 6.5 percent hike that would take effect all at once and be retroactive to fiscal 2017. Health care, fully paid for by the district, and a pension plan would be unchanged under both proposals.

The union also wants significantly smaller class sizes, which routinely top 30 students, and more nurses, librarians, and counselors to “fully staff” the district’s campuses in Los Angeles and all or parts of 31 smaller cities, plus several unincorporated areas.

The Associated Press contributed to this report.