Republican supermajorities in the Kansas Legislature raced Thursday to approve a new plan to reshuffle education spending, hoping to head off the state Supreme Court's threat to shut down public schools statewide if lawmakers don't fix the funding problems by the end of June.

The Senate approved the bill 32-5, and the House passed it hours later, 93-31, sending it to Republican Gov. Sam Brownback, who is expected to sign it by early next month. The votes came only two days after bills containing the plan were introduced in the House and Senate, and GOP leaders took special steps to move with unusual speed.

Republican leaders said they were moving quickly to allow the court plenty of time to review the plan ahead of the June 30 deadline. The justices ruled last month that a 2015 finance law denied poor districts their fair share of more than $4 billion in annual aid to the 286 local districts.

Senate Ways and Means Committee Chairman Ty Masterson, an architect of the plan, said the court has "the hammer of closing the schools."

"We must respond," the Andover Republican said.

But an attorney for four school districts suing the state predicted that the high court would reject the Republican leaders' response - a redistribution of $83 million a year, without an overall increase in state spending.

Because the plan guarantees that no district loses any aid it already has been promised for the next school year, most of them -including the four suing the state - would see no change in their aid overall. Twenty-three would see small increases, covered by the state tapping an existing pot of emergency school aid.

The four districts also argue that the state isn't spending enough money overall on its schools, but the Supreme Court is still reviewing that question. A lower-court panel ruled last year that the state must boost its aid by at least $548 million a year.

"This is a thinly veiled attempt to move money from the left pocket to the right pocket," said John Robb, the attorney for the districts. "I don't have any question but the court's going to reject this."

Predictions like Robb's led Democratic Rep. Jim Ward, of Wichita, to accuse Republicans of "playing Russian roulette with our schools" in passing the plan.

The House's debate grew unusually heated when Rep. John Whitmer, a Wichita Republican, suggested Democrats had no proposals and described the GOP as "those who are doing the work."

House Minority Leader Tom Burroughs, a Kansas City Democrat, responded by accusing the GOP of not supporting education. Pointing and yelling at Whitmer, he called him an "ideologist" and "politician."

GOP leaders sprang to their feet to calm him down as fellow Republicans yelled, "Whoa!" and "No!"

Burroughs apologized but added, "I will stand for children."

Democrats could do little more than complain with GOP moderates and conservatives largely united.

Some Republicans vented about the court. Rep. Marc Rhoades, of Newton, called the justices' demands "ridiculous" - drawing out the word for emphasis - and suggested lawmakers face a moving target to equalize funding that they can never meet.

"You know what that sounds like to me?" Rhoades said. "Socialism."

Top Republicans argued that even though the plan largely reshuffles existing funds, it does so fairly and in a way that will narrow the gap between local property tax levies between wealthy and poorer districts.

The Supreme Court has ruled that the Kansas Constitution requires the state to provide a suitable education to every child, and its funding must both be adequate and distributed to help poor districts keep up with wealthier counterparts. The Dodge City, Hutchinson, Wichita and Kansas City, Kansas, districts sued in 2010 over funding under an old per-pupil aid formula.

GOP lawmakers junked that formula last year in favor of stable "block grants" for districts that make the state's spending more predictable as it struggles to balance its budget. But the justices said the changes didn't provide enough extra aid to poor districts for general operating expenses and building repairs and equipment.