The national push to check union power was dealt a rare blow Tuesday when voters in Missouri rejected a right-to-work law that would have prevented private-sector unions from collecting compulsory fees from workers who do not join.

The law was defeated by a 2-1 margin and came after unions had secured a referendum on the measure, signed into law by then-Gov. Eric Greitens in February 2017. Unions immediately cheered the result on Tuesday, which comes as a relief for Big Labor as a break from a series of blows to union power.

“The defeat of this poisonous anti-worker legislation is a victory for all workers across the country,” AFL-CIO President Richard Trumka said in a statement.

“The victory in Missouri follows a national wave of inspiring activism that is leading to life-changing collective bargaining agreements and electoral triumphs that remind America the path to power runs through the labor movement,” he said.

The result was also hailed by left-wing Sen. Bernie Sanders, I-Vt., who called on right-to-work legislation to be defeated “nationwide.”

“We must stand together, beat back union busters, and continue to build and grow the trade union movement in this country,” he said.

The referendum comes on the heels of the Supreme Court’s Janus decision, which dealt a significant blow to unions by ruling that government workers can’t be forced to pay union fees for collective bargaining. Missouri’s law would have extended protection to all private-sector employees.

A number of states had previously brought in right-to-work laws, despite fierce opposition from union leaders. Since 2012, five strong union states -- Indiana, Michigan, Wisconsin, West Virginia and Kentucky -- have adopted such laws, bringing the total of right-to-work states to 27.

In Missouri, unions had massively outspent right-to-work supporters, pouring more than $15 million into the fight.

“No miscalculation. It was a deluge of money coming in from out of state that helped them get to $20 million to buy the election,” Dan Mehan, executive director of the Missouri Chamber of Commerce and Industry, told The St. Louis Post-Dispatch. “We just got blown out.”

Unions argue that since they must represent employees even if they don’t join the union, it is right that those employees contribute to the union bargaining for them. But right-to-work supporters say that workers should not be forced to contribute to unions, many of which engage in political activity.

The Associated Press contributed to this report.