HARRISBURG, Pa. — A court decision that has hacked a major chunk out of Pennsylvania’s heavily negotiated casino gambling law is prompting fear among lawmakers who represent casino districts that their communities may never recoup the tens of millions of gambling tax dollars they’ve enjoyed over the past decade.

The state Supreme Court, in an opinion released late Wednesday, effectively ends the flow of more than $140 million that Pennsylvania’s 12 casinos pay annually to local government budgets, institutions and projects in Philadelphia and 11 counties.

The guarantee of casino cash for communities was an integral part of the original 2004 law, negotiated behind closed doors and necessary to secure a handful of extra votes to legalize casino-style gambling in Pennsylvania for the first time.

But now a new Legislature must construct a formula to replace the money, if casinos are going to be required to keep subsidizing host communities, and there may not be enough support in the Legislature to revive a provision that simply helps the casinos’ host communities.

Rather, lawmakers without a casino near their district might demand some of that money for their communities, or they might demand an expansion of casino-style gambling that would bring tax dollars to their districts. Allegheny County Rep. Nick Kotik, the ranking Democrat on the House Gaming Oversight Committee, said he wouldn’t be surprised to see 100 different amendments posted by lawmakers to any underlying bill.

“I’m very concerned about the potential loss of funds needed for projects in our community,” said Sen. Rob Teplitz, D-Dauphin, whose central Pennsylvania district includes Hollywood Casino, which pumped more than $14 million into Dauphin County and East Hanover Township last year. “And I fear that opening up the gaming law to address the court’s concerns could produce a free-for-all that could jeopardize that funding even further.”

Cash-strapped municipalities Bethlehem, Bensalem and Chester count on more than $28 million combined every year.

In its ruling, justices agreed with casinos that the formula that dictates how much money casinos must pay their host communities was unconstitutional because it imposed a different financial burden on each casino, and a heavier one on lower-performing casinos.

The high court gave lawmakers four months to come up with a new formula before the ruling takes effect.

Senate Minority Leader Jay Costa, D-Allegheny, whose district gets local tax dollars from the Rivers Casino in Pittsburgh, said the Legislature could vote as early as October to pass a new revenue formula that is designed to pass constitutional muster. But, he said, it will take longer and become more complicated if lawmakers widen their focus to include an expansion of casino gambling or to change the distribution of the local casino revenue.

The money had been negotiated into the casino legislation in 2004 after the bill’s proponents, primarily Democrats and then-Gov. Ed Rendell, needed to secure Republican votes in the GOP-controlled Legislature to pass it.

“I was literally buying votes at that time by adding things for local governments,” said Vincent Fumo, the former Democratic senator from Philadelphia who was a key architect of the law. Kotik said rank-and-file lawmakers had little insight into the negotiations, calling them a “best-kept secret,” and that many realized only after the vote how the cash would be distributed.

Ultimately, Fumo got the Republican votes he needed, and lawmakers justified the dollars for local governments as a way to offset the need for more police officers and road improvements to handle the forthcoming casinos. Now, Fumo suspects that the Legislature will be unwilling to simply revive a provision that rewards casino communities. Instead, he predicted that any replacement provision will distribute casino cash statewide.

“They’re all going to say ‘I want a piece of the action,'” Fumo said, “even if they’re 100 miles away” from a casino.