BOSTON — Unions have spent decades cultivating ties on Beacon Hill and now Massachusetts lawmakers and other elected officials are looking for ways to help unions as they weigh the fallout of a recent Supreme Court decision.

The court ruled last month that public employees can’t be forced to pay fees to labor unions that represent them in collective bargaining.

Labor supporters – many of whom had been bracing for the ruling – fear it could financially weaken unions and affect millions of government workers.

On Beacon Hill, the reaction among some top lawmakers was swift.

Massachusetts House Speaker Robert DeLeo said he would look for ways to soften the blow.

It wasn’t immediately clear what kind of action lawmakers could take, but DeLeo, a Democrat, said legislative leaders are talking to unions to discuss possible action.

“We just want to make sure that unions still have a place here in Massachusetts and they play a role again in the Massachusetts economy,” DeLeo said after the June 27 decision.

DeLeo said he hopes to act before the Legislature completes its formal session on July 31.

Massachusetts Senate President Harriette Chandler called the decision “a disgrace” and “a systematic attack on public workers conceived of and paid for by deep-pocketed corporate interests.”

“This is an attack on fair wages, on affordable health care, on the ability to collectively bargain for equity across the board,” the Democrat said.