But there is a difference between recognizing students’ rights to integrated, adequately funded schools and Judge Treu’s conclusion that teacher employment protections are unconstitutional.

The issue is balance. Few would suggest that too much integration or too much funding hurts disadvantaged students. By contrast, decisions about firing teachers are inherently about trade-offs: It is important to dismiss ineffective teachers, but also to attract and retain effective teachers.

Judge Treu’s opinion in the case, Vergara v. California (in which I provided expert testimony for the defense), ignores these trade-offs. In fact, eliminating tenure will do little to address the real barriers to effective teaching in impoverished schools, and may even make them worse.

The reason has to do with the many ways that the role of teachers in the labor market has changed in recent decades. When few professions were open to highly skilled women, schools could hire them for low salaries. Now, teaching must compete with other professions. That has made it hard to recruit the best candidates. One study found that the share of the highest-achieving women who were teachers fell by half between 1964 and 2000; another found an 80 percent drop.

Thomas J. Kane, a professor of education at Harvard and an expert witness for the Vergara plaintiffs, co-wrote a paper in 2006 on the “coming teacher shortage” and a looming need to “dig further down in the pool of those willing to consider” teaching. Significant layoffs during the last recession, which refilled the pool of job seekers, temporarily alleviated the problem. But those will be absorbed quickly as education budgets recover.

The challenge, then, is to increase the number of high-quality applicants. One of the few things that helps to recruit good people into teaching is job security. That is not to say teachers should never be dismissed — but when and how to do that requires careful balancing.

In a recent study, I examined the effects of changing job protections not just on the quality of teachers given tenure, but also on a district’s ability to attract and retain good ones. My research yielded three salient, surprising facts.

First, firing bad teachers actually makes it harder to recruit new good ones, since new teachers don’t know which type they will be. That risk must be offset with higher salaries — but that in turn could force increases in class size that themselves harm student achievement.

Second, while it might seem better to wait on granting tenure, early decisions — not in the first year, but soon after — actually improve student achievement. That’s partly because stable faculties are better for students, but also because an attentive district knows a great deal about which teachers are good and bad after just two years, and waiting longer provides little additional information.

Finally, the freedom to fire experienced teachers is valuable only when dismissal rates are very high, say, 40 percent or more. And yet such rates come with costs: The risk of firing good teachers is high, and the impact on a school’s culture is detrimental to learning.

But with lower dismissal rates, marginal teachers are much worse than the average new recruit, and it is more important to get rid of them quickly than to get the decision exactly right.

Suppose you don’t want to fire more than 20 percent of teachers. You face a decision: Once you’ve fired the worst 19 percent and have two candidates who each might be the next worst, do you decide early, realizing that you might make a mistake, or do you wait to be sure you’ve got it right? In this case, the costs of waiting outweigh the benefits, and you should do it soon. Tenure laws can usefully tie your hands, forcing you to do that.

In short, while the notion of “clearing the stables” of bad teachers seems attractive, it is almost impossible to get right in practice. No conceivable system can eliminate all “grossly ineffective” teachers, and efforts aimed at doing so can do more harm than good.

Everyone agrees that closing the achievement gap should be a high priority. But the remedy should fit the problem.

The lack of effective teachers in impoverished schools contributes to that gap, but tenure isn’t the cause. Teaching in those schools is a hard job, and many teachers prefer (slightly) easier jobs in less troubled settings. That leads to high turnover and difficulty in filling positions. Left with a dwindling pool of teachers, principals are unlikely to dismiss them, whether they have tenure or not.

Instead, policy makers should continue experiments with bonuses to attract good teachers, as well as ways to reduce the transfer of effective teachers out of schools where they are most needed.

Attacking tenure as a protection racket for ineffective teachers makes for good headlines. But it does little to close the achievement gap, and risks compounding the problem.

Jesse Rothstein is an associate professor of public policy and economics at the University of California, Berkeley.

A version of this article appears in print on , on Page A27 of the New York edition with the headline: Taking on Teacher Tenure Backfires. Order Reprints | Today’s Paper | Subscribe