Joining other counties across the state scrambling to prevent the loss of millions in gambling revenue, Delaware County officials Wednesday announced a deal with Harrah's Casino to keep more than $15 million in annual tax receipts flowing to the county and to the city of Chester.

The agreement - approved by Delaware County Council - came after the state legislature failed this fall to come up with a replacement for the former tax-revenue law, which was struck down as unconstitutional by the Pennsylvania Supreme Court.

For months, county officials and lawmakers have been racing to strike temporary deals with casinos to keep the money flowing before budgets were set to be approved by the end of the year.

The Supreme Court decision guaranteed the funding would continue until Jan. 26. But without a more permanent fix from Harrisburg, local officials had no idea how much money - if any - they could count on for 2017.

For some municipalities, including Chester, the legislature's failure earlier this year to pass a replacement bill plunged officials into uncertainty about how they could make up the millions of dollars that some heavily rely on in their budgets.

For now, the deals ensure local governments will have casino money into next year. Still, state legislators must find a more permanent fix when they begin their session in January.

In Delaware County, the arrangement facilitated by Republican Sens. Thomas McGarrigle and Tom Killion, other lawmakers, and Delaware County Council means the county will receive the $4.9 million contribution it has been receiving from Harrah's Philadelphia. Chester City, where the casino is situated, will receive $10.5 million.

Bucks County has reached a similar agreement with the Parx Casino that would guarantee $3.5 million to the county, $3.5 million to the county Redevelopment Authority, and $10 million to Bensalem, where the casino is situated, Sen. Tommy Tomlinson (R., Bucks) said Wednesday. The agreement is set to be approved by the township and county commissioners before the end of the year.

In Dauphin County, where Harrisburg is the county seat, officials in November also reached an agreement with Penn National Gaming, the parent company of Hollywood Casino at Penn National Race Course. There, a memorandum of understanding guarantees that the casino will fund at least half of its 2017 obligation - roughly $6.5 million. The agreement expires June 30.

A deal was also struck in Plains Township, in Luzerne County. Similar negotiations are ongoing in Allegheny and Erie Counties.

"I'm happy that we have some certainty because we approve our budget next week," Delaware County Councilman John McBlain said Wednesday. " . . . We're very thankful [Harrah's] stepped up to the plate, as they have always done."

The deals across the state, however, do not let legislators off the hook. Republicans who control both legislative chambers said Wednesday that lawmakers still plan to craft a more permanent fix for the problem upon their return early next year.

Since 2004, most casinos outside Philadelphia have been required to pay a portion of their slot-machine revenue to the counties and municipalities that host them: 2 percent to counties, and 2 percent or $10 million - whichever is greater - to the municipalities.

Earlier this year, the Mount Airy Casino Resort, a smaller casino, challenged the $10 million as unconstitutional for imposing an uneven tax rate. The Supreme Court agreed and gave legislators 120 days to find remedies.

With Pennsylvania in desperate need of revenue, lawmakers for months had considered expanding legal gambling as a source of funding in the face of a looming deficit in the 2016-17 budget. Many Pennsylvania casinos vehemently opposed the possibility.

In October, in an attempt to accommodate the Supreme Court decision on one of the legislature's final days of 2016, the House passed a complex bill that would keep money flowing to municipalities and counties - and legalize internet and fantasy sports gambling.

The Senate postponed considering the plan until January.

The lack of funds could have proved almost crippling for Chester, which counts on casino funds for nearly a third of its annual budget

For other governments, the matter of whether taxpayers would bear the brunt of the shortfall became a key question.

"[Harrah's] really worked well with us and said, 'We want to make this work, this is a tax we have to pay,' " Killion said Wednesday. " . . . [They] were very cooperative."

Officials from Harrah's Philadelphia did not return calls for comment Wednesday.

610-313-8113 @mccabe_caitlin