In 2011, large protests against bills undercutting the political power of public employee unions rocked the Wisconsin Capitol in Madison, sparking recall elections that nearly toppled Gov. Scott Walker (R). Four years later, Republicans want to avoid a repeat as they consider another measure that would curb union power.

The state Senate Labor Committee began hearing testimony Wednesday on “right-to-work” legislation, which allows employees to opt out of joining a labor union. Republican leaders said last week they will fast-track the bill after securing the votes to pass it in the state Senate and Assembly.

The goal of moving so fast, according to state Sen. Steve Nass (R) — final passage in the Assembly could come as early as next week — is to finish the bill before protesters materialize.

“It’s prudent to not let this languish for months,” Nass told the Milwaukee Journal Sentinel. Nass said that the protests in 2011 created an unsafe atmosphere for legislators, who had to “go through tunnels like rats” to enter the Capitol building. State Senate Majority Leader Scott Fitzgerald (R) said he would advance the bill now, earlier than initially planned, because of the threat of television advertising against it by unions and pro-labor groups.

In 2011, labor leaders marshaled tens of thousands of protesters to oppose measures that stripped public employee unions of collective bargaining rights and that ended the state’s automatic collection of union dues. Anger over the measures, which the Republican-controlled legislature passed and Walker signed, led union officials and Democrats to circulate recall petitions that ultimately unseated two Republican state senators.

This year, protests have already begun. Between 1,800 and 2,000 pro-union activists showed up on the Capitol steps Tuesday to oppose the legislation.

After the unrest of 2011, Walker has been cautious about right-to-work legislation. He said in 2012, as he successfully fought off a recall attempt, that he would work to keep right-to-work bills out of the legislature. While running for reelection in 2014, Walker said right-to-work wasn’t a priority for him.

But last week, Walker said he would sign the legislation if it reaches his desk, once Fitzgerald made it clear that he had the votes necessary to get it through the state Senate.

“I’ve never said that I didn’t think it was a good idea. I’ve just questioned the timing in the past and whether it was right at that time,” Walker told the Journal Sentinel while in Washington for the annual meeting of the National Governors Association.

Walker told The Washington Post in a separate interview that he “absolutely” would sign the bill. Walker said that he has always believed right-to-work was a good idea but that legislators shouldn’t bring up such a divisive issue unless they had the votes to pass it. Asked whether he thought Republicans have the votes this time, he said, “I believe they do.”

When Republicans initially signaled they would propose right-to-work legislation in December, the top AFL-CIO official in Wisconsin said similar laws in other states had been detrimental to workers and wages.

“Any introduction of right-to-work  legislation would be a move in the wrong direction for Wisconsin and a serious disappointment at a time when Wisconsin needs legislators to focus on family-supporting jobs and reviving our sluggish economy,” Stephanie Bloomingdale, Wisconsin AFL-CIO secretary-treasurer, said in an e-mail at the time.

The state Senate, where Republicans hold an 18 to 14 advantage, is expected to pass its bill as early as Wednesday. The Assembly, where Republicans hold a 63 to 36 edge, will probably act next week.

Right-to-work  laws are in place in 24 states. This year, legislators in New Mexico, New Hampshire, Ohio and Missouri introduced or plan to introduce versions of the law.

The power of unions has waned in recent decades. The number of workers who are union members has declined in 43 states over the past 10 years, and just 11.3 percent of wage and salary workers were union members in 2013, according to the Labor Department.

Republicans began pushing the first versions of right-to-work legislation in the 1940s and 1950s, when 17 states, mostly in the South and Midwest, passed bills, according to Jeanne Mejeur, an analyst at the National Conference of State Legislatures. Michigan and Indiana were the two most recent states to pass right-to-work laws, in 2012.

Dan Balz contributed to this report.