It won’t be as simple from now on for ineffective California teachers to coast off to a lifetime career on easy street.

In a Los Angeles Superior Court ruling today, Judge Rolf M. Treu “found five California laws governing teacher tenure, layoffs and dismissals unconstitutional,” reports Politico.

“Treu found,” reporter Stephanie Simon wrote, “that the statutes permit too many grossly incompetent teachers to remain in classrooms across the state —and found that those teachers shortchange their students by putting them months or years behind their peers in math and reading.”

There’s no doubt that not all teachers are created equal. Some are excellent, of course. But not all of them are, and in California, it’s almost impossible to fire a tenured teacher.

The case, which was brought by nine public school students, challenged five California statutes related to teacher tenure, including one that requires teachers to receive tenure—or be dismissed—after a mere 16 months on the job. In contrast, 41 other states give school authorities a full three years to make that tenure decision.

Students Matter, a group affiliated with the nine students in the case, asserts that poor teachers were hurting California students. “According to the testimony of Dr. Raj Chetty, a student assigned to a grossly ineffective teacher loses $50,000 in potential lifetime earnings compared to a student assigned to a teacher of average effectiveness,” states the group’s fact sheet.

Minority students have been particularly hard hit. “According to the testimony of Dr. Thomas Kane, in Los Angeles Unified [school district], African American students are 43 percent more likely than white students to be taught by a teacher in the bottom 5 percent of effectiveness,” Students Matters wrote. It’s an even worse story for Latino students, who “are 68 percent more likely to have a teacher in the same 5 percent of effectiveness.”

The ruling should help boost California public school students’ access to a decent education. This “tentative decision” (the court’s words), based on the California Constitution, will likely be appealed. While assessing the quality of education is normally a policy matter best left to the legislature, unless you’re a lousy teacher, this should be a cause for celebration.