Wisconsin Gov. Scott Walker’s victory in a recall election Tuesday amounted to a significant defeat for the nation’s labor unions, which had mounted one of their most aggressive grass-roots campaigns ever to defeat the Republican.

As one of his first acts after taking office two years ago, Walker targeted the unions representing government workers, moving to curb their collective-bargaining rights. The failed effort to oust him sent reverberations across the labor movement and the Democratic Party, signaling that one of President Obama’s most powerful constituencies is politically vulnerable and may not be able to help him as much as expected in this year’s election.

Allied labor groups rallied more than 50,000 volunteers who knocked on 1.4 million doors and placed 1.8 million calls, according to figures from the American Federation of State, County and Municipal Employees (AFSCME). The AFL-CIO deployed the best of its targeting and technical team to try to rally opposition against Walker. The weeks-long standoff at the Wisconsin state Capitol last year, which drew tens of thousands of union supporters and national attention, had invigorated the movement, too.

But even after the groups allied against Walker spent $18 million, it was insufficient to match the governor, whose campaign and supporters spent $47 million, according to figures from the Wisconsin Democracy Campaign, a nonpartisan group that tracks political spending.

In interviews, union leaders rejected the idea that the outcome reflected any growing antipathy toward labor, or a diminished presence of unions.

The campaign “showed our ability to put boots on the ground,” said Gerald McEntee, the head of AFSCME.

The unions did have some success. The share of people from union households who voted rose from 26 percent in 2010 to 33 percent on Tuesday. Voters also narrowly ousted a Republican from the state Senate, according to preliminary results, apparently shifting the balance of power there.

Moreover, in Ohio, after Gov. John Kasich (R) approved a similar law to curtail collective-bargaining rights for state workers, voters there overwhelmingly overturned it in November.

“This was a defeat and a serious one for unions,” Harley Shaiken, a professor at the University of California at Berkeley who studies unionism, said of the Wisconsin vote. “But it doesn’t say they’re a paper tiger. It says they’re vulnerable.”

Walker and his supporters used much of their financial advantage for television ads, inundating the airwaves with messages arguing that his moves against the unions were necessary. “The reforms are working,” one the spots broadcast statewide told viewers.

They also touted figures that showed that the state was facing a deficit of as much as $3.5 billion.

“This was a referendum on collective-bargaining rights, and the unions lost,” said Luke Hilgemann, director of Americans for Prosperity Wisconsin, an issues advocacy group that spent more than $5 million on the campaign. “The taxpayers of Wisconsin made it very clear that they did not support lavish pay and benefits for government workers.”

The setback in the Badger State pointed anew to a strategy favored by many Republicans to weaken the unions as a way to permanently weaken the Democratic Party. Union membership has continued to decline over the years. After a decades-long slide, union members represent less than 7 percent of the private-sector workforce.

Approximately 37 percent of the government workforce is composed of union members.

The reforms that Walker and many other Republican governors (and some Democratic ones) have sought mostly affect pay and benefits. But efforts to chip away at collective-bargaining rights can deal a significant blow to the unions’ treasuries and therefore their organizing strength.

Steve Rosenthal, a Democratic strategist with strong labor connections, said the outcome was “a big loss” for the unions.

But he argued that they had no choice but to fight after Walker took away most collective-bargaining rights for public employee unions. “Having been drawn into that fight, they waged an incredible campaign,” he said.

Rosenthal said he could see some potentially beneficial results from the recall battle. He predicted that other governors would not want to go through what Walker has experienced in the past 18 months and as a result will tread more lightly in attempting to roll back public employee benefits and workplace rights.

Privately, allies of organized labor described the Wisconsin results in more downbeat terms.

“It has helped further drain treasuries of institutions that are not particularly flush,” said a Democrat who works closely with the unions and who spoke on the condition of anonymity to offer a candid assessment. “From a political, psychological point of view . . . it’s a very major setback.”

Said McEntee: “I think [Republicans] see it as a way to weaken the Democratic Party. I think that labor in general is one of the legs on the stool of the Democratic Party. They see it. They know it.”

AFL-CIO President Richard Trumka told reporters Wednesday that he regretted that the campaign was not waged more directly on the issue of collective-bargaining rights. “This particular election . . . wasn’t about collective bargaining the last month,” he said. “I wish it had been. But it wasn’t.”

Others critiquing labor’s performance argued that the problem with its approach in Wisconsin and in some other campaigns is that it is too focused on a narrow, labor-oriented message instead of one that can appeal not only to union members but also to swing voters.

Tuesday’s results confirmed the worst fears of those Democrats who had privately argued against trying to oust Walker. Obama campaign officials were among those cautioning against the recall effort, as were others associated with the labor movement.

Some had argued that labor should have walked away from its defeat last fall of collective-bargaining changes enacted by Kasich and saved its resources for this November. “They never should have gotten into it in the first place,” a Democratic strategist said. “There were significant numbers of people who thought it was a complete waste of time and waste of resources.”