WASHINGTON - From California to Maine, unions used their political muscle in the recent elections to help install Democratic governors, build labor-friendly majorities in state legislatures and defeat ballot initiatives against them.

The combination of union money and member mobilization helped Democrats take control of state legislatures in Maine and Minnesota.

In Michigan, voters repealed a law that allowed cities in financial distress to suspend collective bargaining contracts. But unions lost there on an effort to make collective bargaining rights a part of the state constitution.

In New Hampshire, unions helped Maggie Hassan win the governor's race. Unions spent millions backing Hassan with television ads and an extensive get-out-the-vote operation because she opposes a right-to-work bill to ban labor-management contracts that require affected workers to be union members or pay union fees.

In perhaps their most important victory, unions defeated a California ballot measure that would have prohibited them from collecting money for political purposes through payroll deductions.

"The unions must be fairly happy with themselves," said Gary Chaison, professor of industrial relations at Clark University in Worcester, Mass. "These are positive signs, particularly saving their political life in California."

While re-electing President Barack Obama was labor's highest Election Day priority, unions invested major resources in state races where they have been fighting efforts by governors and state lawmakers to restrict bargaining rights or dilute union power.

The victories could mark a turnaround of sorts for unions nearly two years after Wisconsin Gov. Scott Walker announced plans to strip teachers, nurses and other public employees of most collective bargaining rights. Walker, a Republican, justified the move as necessary to trim the state's budget shortfall.

Since then, unions have been fighting dozens of measures around the country targeting labor rights. They failed earlier this year to recall Walker from office, but a judge has declared parts of the Wisconsin law unconstitutional.

It wasn't all good news for unions on election night. They lost a first-of-its-kind ballot effort in Michigan that would have enshrined collective bargaining rights in the state constitution.

Unions saw the measure as a way to prevent Republicans from passing a right-to-work law that would have ended unions' ability to collect fees from nonunion workers. Critics said it would cause the repeal of dozens of state laws and interfere with local officials trying to control their budgets. One union-backed group spent at least $6.5 million on TV ads supporting it.

Labor's victories came at a steep cost. Unions and other Democratic interests poured at least $75 million into the effort to defeat California's Proposition 32.

Unions are not so much thriving as surviving.

"Thanks to union dues, it's a self-replenishing stream," said Bill Whalen, a fellow at the conservative Hoover Institution. "They still have a sea of money to spend and they prove quite adept at winning political arguments."

After playing defense in more than a dozen states for the past two years, unions see no other choice. Public employee unions now make up a majority of the nation's 14.8 million union members, but they have taken a hit as state and local budgets shrink, forcing layoffs and cuts to salaries and pension benefits.

The 1.3-million-member American Federation of State, County and Municipal Employees, the nation's largest public employee union, has lost about 10 percent of its active members since 2009. The National Education Association, which represents public school teachers, lost more than 100,000 members since 2010.

"I'm not going to be cocky about anything," AFL-CIO political director Mike Podhorzer said. "There are still plenty of Republicans in office and we don't expect them to change their spots overnight."

Next to winning Obama's re-election, defeating Proposition 32 in California was labor's top goal. Prohibiting unions from collecting money for political activities through paycheck deductions would have deprived them of tens of millions of dollars for donations to candidates and financing campaigns.

In New Hampshire, unions were worried that the state legislature had passed right-to-work measures in the previous two legislative sessions. But lawmakers could not override a veto by Democratic Gov. John Lynch. Hassan's victory gives unions similar protection.

In Minnesota, gaining Democratic control of the state legislature could help the Service Employees International Union change a state law to allow the union to organize more than 12,000 day care providers in the state.

Perhaps the largest issue looming for public employee unions in the next few years is the shortfall in government pension systems, which have sunk deeper into the red as the recession has taken its toll. Cities and states around the country — led by Republicans and Democrats alike — have been reducing promised benefits to public workers and retirees as they attempt to cover shortfalls. States need about $1.4 trillion to fulfill their pension obligations, according to the Pew Center on the States.

Over the summer, the Governmental Accounting Standards Board approved new accounting rules for pensions that will make some underfunded plans look worse when the rules begin to go into effect late next year. State and local governments will have to print their total unfunded liability on the front of financial statements.

"It's going to help identify those plans in serious trouble, which could help policy makers and the public be aware of the need for action," said David Draine, a researcher who tracks pension changes at the Pew Center.

That could increase pressure on elected officials to reduce benefits and make bargaining more difficult for unions.