Wisconsin Gov. Scott Walker has won his drive to strip the state’s government workers of nearly all of their collective-bargaining rights, prevailing after a three-week standoff that brought tens of thousands of protesters to the Capitol and transfixed the political world.

The new legislation, which Walker signed into law Friday, represents a major setback for organized labor, but the political battle over public employees and their rights to bargain is likely to continue — not only in Madison.

The state Assembly passed Walker’s proposal Thursday, a day after Republican senators outmaneuvered the 14 Democratic senators who had fled Wisconsin to deny a quorum needed for passing a budget measure. By stripping the bill of its spending language, they were able to pass it with only Republicans present.

Despite losing the battle in Wisconsin, union leaders said it would have repercussions across the country.

“It’s not over. This may be a battle that has been won by the governor, but we are in this for the long haul,” said Lee A. Saunders, secretary-treasurer of the American Federation of State, County and Municipal Employees, which is the nation’s largest government-worker union.

Wisconsin was in many ways an unlikely spot for such a political conflagration. The state was the first to grant collective-bargaining rights to its public employees, back in 1959. Only about half the states allow broad collective bargaining for their public employees.

Although Wisconsin has traditionally had liberal and conservative forces, “usually the discourse is much more civil and deliberate, even when there are differences in public policy,” said Dennis L. Dresang, the founding director of the La Follette School of Public Affairs at the University of Wisconsin at Madison. “If this can happen in Wisconsin, it can happen anywhere.”

A number of public polls have indicated that although Wisconsin voters support Walker (R) in his drive to cut state spending, they oppose him on taking away the rights of unions to negotiate.

The public employee unions initially resisted the governor’s proposal that workers increase the contributions they make toward their pensions and their health benefits. But last month, they said they would consider that proposal — a move that put the focus of the struggle on the larger issue of collective-bargaining rights.

Walker has argued that local governments and school districts need to be able to rein in the unions if they are to cope with expected cuts in state aid.

“Local governments can’t pass budgets on a hope and a prayer,” the governor wrote in an op-ed in Thursday’s Wall Street Journal. “Beyond balancing budgets, our reforms give schools — as well as state and local governments — the tools to reward productive workers and improve their operations. Most crucially, our reforms confront the barriers of collective bargaining that currently block innovation and reform.”

What remains to be seen is whether the Wisconsin saga sets off similar epic battles in other states — or becomes a cautionary lesson. “It’s a bit of an inpiration for other governors, but they are also seeing the pounding,” said Republican political consultant Mike Murphy.

Even though Walker won this round, there may be others. The unions and their allies have said they intend to mount recall campaigns against Republican state senators; conservatives have threatened to do the same against the Democrats who fled Wisconsin.

At this point, only eight senators from each party are eligible for recall under a state law that requires a year to pass after an official’s election before he or she can be booted from office.

Although no other governor has been as confrontational with the unions as Walker has, some of the same issues are in play elsewhere.

Many of them are states, like Wisconsin, where Republican governors came to power in last year’s elections promising fiscal discipline. As their states grapple with massive budget deficits, these governors are arguing that they cannot deal with their fiscal problems without curbing the power of the public-sector unions.

The Ohio Senate has passed legislation, championed by the new governor, John Kasich (R), that would limit collective bargaining for government workers. The bill is awaiting action in the House.

In Michigan, the state Senate on Wednesday passed a proposal by Republican Gov. Rick Snyder that would give governor-appointed emergency managers the power to break labor contracts in failing schools and cities.

“Wisconsin’s Governor Walker may be entering the front door on undoing workers’ rights, but make no mistake. You all are sneaking in the back door to do the same thing with this vote,” Michigan Senate Minority Leader Gretchen Whitmer (D) said during the debate before the vote.

In other states, governors are proposing that state and local workers contribute more to their benefits. But some of them, including Florida’s new Republican governor, Rick Scott, have said they would not attempt to strip those employees of their collective-bargaining rights.

Unions and their allies say the showdown in Wisconsin has galvanized and energized a liberal base that had been in a state of deep malaise after the beating that Democrats took in last year’s elections.

Walker is “winning the battle through pure, uncompromising force, but he’s losing the war,” said Democratic pollster Mark Mellman.

Union officials say it is not a coincidence that many of these anti-union efforts are taking place in states that are must-wins for Democrats in the 2012 election.

“It’s a coordinated effort in the battleground states to try to diminish the strength and diminish the power of the public-sector unions because we stand in their way,” Saunders said. “If they take us out, then the Democratic Party loses a very large grass-roots operation.”

Staff writer Michael A. Fletcher contributed to this report.