Siding with the nine students who brought the lawsuit, he ruled that California's laws on hiring and firing in schools have resulted in "a significant number of grossly ineffective teachers currently active in California classrooms."
He agreed, too, that a disproportionate number of these teachers are in schools that have mostly minority and low-income students.
The judge stayed the ruling pending appeals. The case involves 6 million students from kindergarten through 12th grade.
The California Attorney General's office said it is considering its legal options, while the California TeachersAssociation, the state's biggest teachers union with 325,000 members, vowed an appeal.
"Circumventing the legislative process to strip teachers of their professional rights hurts our students and our schools," the union said.
Teachers have long argued that tenure prevents administrators from firing teachers on a whim. They contend also that the system preserves academic freedom and helps attract talented teachers to a profession that doesn't pay well.
Other states have been paying close attention to how the case plays out in the nation's most populous state.
"It's powerful," said Theodore Boutrous Jr., the students' attorney. "It's a landmark decision that can change the face of education in California and nationally."
He added: "This is going to be a huge template for what's wrong with education."
The judge declined to tell the Legislature exactly how to change the system, but expressed confidence it will do so in a way that passes constitutional muster and provides "each child in this state with a basically equal opportunity to achieve a quality education."
The lawsuit contended that incompetent teachers are so heavily protected by tenure laws that they are almost impossible to fire. The plaintiffs also charged that schools in poor neighborhoods are used as dumping grounds for the bad teachers.
In striking down several laws regarding tenure, seniority and other protections, the judge said there was compelling evidence of the harm inflicted on students by incompetent teachers.
"Indeed, it shocks the conscience," Treu said.
He cited an expert's finding that a single year with a grossly ineffective teacher costs a student $50,000 in potential lifetime earnings.
California teachers receive tenure after just two years, sooner than in virtually any other state. If a school district moves to fire a tenured teacher and the educator puts up a fight, it triggers a long, drawn-out process, including a trial-like hearing and appeals.
Los Angeles School Superintendent John Deasy testified it can take over two years on average — and sometimes as long as 10 — to fire an incompetent tenured teacher. The cost, he said, can run from $250,000 to $450,000.
In his ruling, the judge, a Republican appointee to the bench, said the procedure under the law for firing teachers is "so complex, time-consuming and expensive as to make an effective, efficient yet fair dismissal of a grossly ineffective teacher illusory."
The judge also took issue with laws that say the last-hired teacher must be the first fired when layoffs occur — even if the new teacher is gifted and the veteran is inept.
The case was brought by a group of students who said they were stuck with teachers who let classrooms get out of control, came to school unprepared and in some cases told them they'd never make anything of themselves.
"Being a kid, sometimes it's easy to feel like your voice is not heard. Today, I am glad I did not stay quiet," said one of the students, Julia Macias. "I'm glad that with the support of my parents I was able to stand up for my right to a great education."
The lawsuit was backed by wealthy Silicon Valley entrepreneur David Welch's nonprofit group Students Matter, which assembled a high-profile legal team including Boutrous, who successfully fought to overturn California's gay-marriage ban.
Dennis Van Roekel, president of the National Education Association, the nation's biggest teachers union, bitterly criticized the lawsuit as "yet another attempt by millionaires and corporate special interests to undermine the teaching profession" and privatize public education.
The trial represented the latest battle in a nationwide movement to abolish or toughen the standards for grantingteachers permanent employment protection and seniority-based preferences during layoffs.
Dozens of states have moved in recent years to get rid of such protections or raise the standards for obtaining them.
U.S. Education Secretary Arne Duncan hailed the judge's ruling as a chance for schools everywhere to open a conversation on equal opportunity in education.
"The students who brought this lawsuit are, unfortunately, just nine out of millions of young people in America who are disadvantaged by laws, practices and systems that fail to identify and support our best teachers and match them with our neediest students," he said. "Today's court decision is a mandate to fix these problems."
Copyright 2014 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.