(CNN) -- Chants of "Shame on you" rained down from a packed Michigan state Senate gallery Thursday as the state's lame-duck GOP legislature advanced legislation giving workers the right to opt out of union membership.
Labor unions and Democrats in the state legislature, some of whom walked out on the vote, lambasted the rush move as a stealthy subversion of the public will in labor-heavy Michigan.
"Republicans who got defeated up and down the ballot are using this lame-duck legislature to try and jam through legislation that flies in the face of what the voters wanted," said Bob McCann, the spokesman for the state's Senate Democratic Caucus. "It's a disgusting process and a disgusting result."
Michigan's house passed two bills and the state Senate approved one that would make Michigan a "right to work" state in which public and private workers could opt out of union membership and dues. The bills must be now voted on by the opposite chamber before going to Gov. Rick Synder, who supports the change.
Twenty-three U.S. states have similar legislation, according to the National Right To Work Legal Defense Foundation.
Republican supporters, including Gov. Rick Snyder, said the proposal would improve the state's economic competitiveness.
"Under freedom to work, Michiganders will have the freedom to choose whether or not to join a union," Snyder said. "They won't be forced to pay union dues if they don't want to, and they won't lose their jobs because of it. And if they want to pay dues voluntarily, they have the freedom to do that, too."
Synder announced the surprise plan to reporters Thursday morning. Within hours, thousands of labor supporters descended on the capitol building in Lansing to protest, but were met by police who used pepper spray to keep some of them out of secure areas.
Authorities arrested eight people and locked down the building, preventing thousands of protesters from getting in and drawing the ire of Democratic Sen. John Gleason.
"They're just ramming it through with no public involvement," he said. "They locked the state Capitol down. Every way they could, they shut the people out of the process."
Police said they were not trying to limit protest rights but were fearful of a repeat of events last year in Wisconsin, where demonstrators occupied the statehouse to protest Republican Gov. Scott Walker's efforts to strip union rights from most state jobs.
"People have a right to protest but it will be done in an orderly manner," state police Inspector Jean Adamczyk told CNN affiliate WDIV.
The building was locked down because its capacity had been exceeded, he said. Enough people had gotten in to fill the gallery.
Gleason complained that Republicans used a legislative maneuver -- placing the provisions in an appropriations bill -- to prevent voters from having the opportunity to overturn the decision.
"If you dedicate funds to legislation, it can't be overturned by the public," he said.
Lawmakers also skipped committee hearings that normally precede the final passage of legislation, McCann said.
"That's a complete subversion of how the legislative process is supposed to work," he said. "They've just completely thrown that out the window."
McCann said it's likely Democrats would challenge the validity of the legislation in court if it wins final approval.
State law requires the House to wait five days before considering the bill.
Michigan, with its ties to the auto industry, has long been a stronghold for the labor movement; 671,000 residents of the state are union members. But the state has suffered economically in recent years and Synder said employers need the flexibility to compete with businesses in neighboring Indiana and other states with right-to-work laws.
The proposal would not affect collective bargaining rights, except to eliminate the ability of unions to have companies fire workers who refuse to pay union dues, said F. Vincent Vernuccio, director of labor policy for the free-market Michigan think thank, the Mackinac Center.
Synder, in a blog entry on his website, said he thinks Republicans weren't trying to destroy unions.
"We owe much to the labor movement -- the end of child labor, the 40-hour work week, safe working conditions in factories, and a guaranteed minimum wage," he said. "The labor movement is an important part of Michigan's fabric, and nothing about this proposal eliminates it."
But Michigan State AFL-CIO President Karla Swift said the bill doesn't help workers at all.
"In the wake of this legislation, the only 'freedom' gained for Michigan workers will be the freedom to make less, the freedom to be disrespected at work, the freedom to struggle to pay their bills and the freedom to be left out of the American dream," she said.
CNN's John Fricke, Dave Alsup and Michael Pearson contributed to this report