Updated

Wisconsin’s contentious union rights law is set to go in effect following a sharply divided ruling by the state Supreme Court.

The decision is a major victory for Republican Gov. Scott Walker after a long and dramatic battle that was met with heavy protests in the state’s capitol and across the country.

The high court upheld Walker’s law in a 4-3 vote Tuesday evening, determining that a judge overstepped her authority when she voided the governor's plan to strip most public workers of their collective bargaining rights.

An avalanche of lawsuits is expected, because legal challenges couldn't be brought until the law took effect.

Walker says the legislation is necessary for Wisconsin to address its $6.3 billion budget shortfall.

"The Supreme Court's ruling provides our state the opportunity to move forward together and focus on getting Wisconsin working again," Walker said in a statement.

Union leaders blasted the court's decision. Phil Neuenfeldt, president of the Wisconsin State AFL-CIO, called it "an affront to our democracy."

The law passed in March after weeks of protests that drew tens of thousands of people to the state Capitol. But the law has been tied up in the courts since a Democrat filed a lawsuit accusing Republicans of violating the state open meetings law during the run-up to passage.

The Wisconsin Supreme Court said the judge had no authority to interfere with the legislative process.

"We've done the best we can ... It looks like we've lost," Dane County District Attorney Ismael Ozanne, who filed the lawsuit, said after the ruling.

The court ruled Tuesday just hours before the Republican-controlled Assembly was planning to start debating the state budget and possibly adding the collective bargaining provisions.

Supreme Court Chief Justice Shirley Abrahamson wrote a blistering dissent of the court's ruling, accusing Justice David Prosser of appearing to have a "partisan slant" with his concurring opinion.

Abrahamson says the ruling was hastily reached. It came just eight days after oral arguments.

Abrahamson was joined in the dissent by Justices Ann Walsh Bradley and Patrick Crooks. In the majority were Prosser, Michael Gableman, Annette Ziegler and Patience Roggensack.

The Associated Press contributed to this report.