IN AN IDEAL world, there would have been no recall election in Wisconsin on Tuesday.

As many of those who voted for Gov. Scott Walker (R), the winner, apparently believed, it is destabilizing and unfair to make an official face an electoral do-over before his or her term ends. Mr. Walker took office only a year and a half ago and has not been credibly accused — much less convicted — of a major legal transgression. Divisive and politically motivated though it may have been, the curtailment of collective bargaining for public-sector unions that Mr. Walker and a GOP legislature enacted was well within their constitutional powers. Those who objected had ample opportunity to hold their leaders accountable in 2014.

And Wisconsin never should have found itself in the fiscal predicament that gave Mr. Walker a reason — or an excuse, depending on your point of view — to confront the unions. Unfortunately, for many years prior to Mr. Walker’s election in 2010, politicians of both parties approved unsustainable pay, pensions and health benefits for public employees, knowing that the full bill would not come due until long after they had left office.

Wisconsin is far from the only state whose politicians and government unions played such a game — certain jurisdictions in our own area come to mind — and the Badger State was not one of the worst offenders. The situation is especially dire in California and Illinois. But Wisconsin’s structural budget deficit was bad enough to give Mr. Walker his opening, and he took it.

History will judge both the way he went about reining in the unions and the results he got. So far, his opponents’ predictions of disaster have not materialized. The state has balanced its two-year budget without tax increases, and local school districts have used their new bargaining power to save money without layoffs or significant increases in class size. Higher tax revenues, the fruit of an improving national economy, have helped. But those who voted for Mr. Walker to show approval for his policies, and not just disapproval for the recall itself, had plausible reasons for doing so.

For public-employee unions, the lesson could not be clearer. Their instinct to punish Mr. Walker, so as to deter imitators, was understandable, but it led them down a blind alley. Public concern about the cost of state and local government is real, justified and spreading. Voters are not content with policy menus that include only service cuts and tax increases, without significant, permanent reductions in personnel costs that make up the lion’s share of budgets. Even as Wisconsinites were voting for Mr. Walker, voters in two of California’s biggest cities, San Diego and San Jose, were approving ballot measures to trim their public-employee pension burdens.

Public-employee union leaders are pledging to fight those new laws in court, just as their counterparts in Wisconsin and elsewhere are dismissing Mr. Walker’s victory as the product of out-of-state campaign donations. They would do better to engage governments in a good-faith effort to restructure and preserve public services for the long term. States and localities face genuine financial problems, and the unions share responsibility for them.