CHICAGO (Reuters) - With a budget deal elusive and a midnight Friday deadline fast approaching, Illinois faces a crisis that threatens everything from its education system to government payrolls and the likelihood of becoming the first U.S. state ever with a junk credit rating.

Illinois, which has gone a record-setting two straight years without a complete spending plan due to an impasse between its Republican governor and Democratic legislature, is poised to start fiscal 2018 on Saturday budget-less again.

The consequences would be dire for the nation’s fifth-largest state, which has a $15 billion backlog of unpaid bills.

S&P has warned that starting a new fiscal year without a budget that reduces a chronic structural deficit could trigger a downgrade to BB-plus. That would put Illinois on the same financial footing as Azerbaijan, Bulgaria and Portugal.

“The lack of a budget makes all the difference here,” said S&P analyst Gabriel Petek, who voiced concerns about the state’s ability to control its finances and cash flow.

Even the agency that oversees elections is not immune. A top Illinois State Board of Elections official told Reuters the agency faces the loss of certain cyber security protections beginning in September because of an unpaid $9,000 bill. The board is among 21 state election authorities the U.S. Homeland Security Department confirmed were targeted by Russian hackers during the 2016 election.

An immediate casualty is the state lottery. For the first time, Illinois suspended sales of Powerball and Mega Millions tickets and announced a delay in payments after Saturday on any prizes exceeding $25,000.

The lack of a state budget threatens serious disruption to schools during the next six weeks. Out of Illinois’ 401 public school systems, 144 expect to have less than 90 days of operating cash at fiscal year-end, said Robert Wolfe, chief financial officer for the Illinois State Board of Education.

“If there is no budget, it is doubtful we can open our doors on August 15th,” said Ralph Grimm, school superintendent in Galesburg, Illinois.

Public universities, which have suffered a steep drop in state funding, now fear further erosion in student enrollment, the loss of accreditation, and bruising spending cuts.

BUDGET CRISIS, HUMAN FACE

Lindsay Perez, a suburban Chicago mother, and her 9-year-old daughter Elena, who survives on a Medicaid-funded ventilator, described for reporters on Thursday the horrific situation of losing some of her medical supplies because of the budget crisis.

The girl, who was born without a lung, urged politicians to pass a budget.

“If you could try hard enough, you could do it,” she said.

Meanwhile, Illinois risks intervention from federal judges overseeing consent decrees requiring the state to fund medical and other services for the disadvantaged.

A U.S. judge is weighing how much more Illinois must allocate to pay down $3.1 billion in Medicaid bills to ensure continued medical care for 3 million poor and disabled residents.

Illinois Comptroller Susana Mendoza, whose office pays the state’s bills, has pledged to fully cover debt service on bonds, but essential payments for pensions and payroll could face reductions if the judge orders a higher priority for Medicaid.

Democratic House Speaker Michael Madigan offered reporters a murky response on Thursday when asked if a resolution to the fiscal mess could be struck with Governor Bruce Rauner by the midnight Friday deadline.

“Oh sure, if everybody is reasonable,” Madigan said of a potential breakthrough. “It could’ve been done two years ago.”

The long odds that Madigan and Rauner, who posted a Twitter photo of himself at his desk waiting for a “balanced budget,” could strike a deal appeared to worsen with Thursday’s abrupt resignation of Senate Republican Leader Christine Radogno, respected by both parties as an expert negotiator.

“I really tried hard. It’s time for someone else to take the reins,” she told reporters.