The Kansas Supreme Court ruled on Friday that the state Legislature had failed to equitably fund public schools, once again giving the state until June 30 to fix its financing system or face a court-ordered shutdown of schools.

The ruling was the latest volley in a long battle over public education in Kansas. A lawsuit from a coalition of school districts led the Kansas Supreme Court to order the Legislature in 2014 to increase funding to poorer districts.

The court and the Legislature have been at odds ever since. In February, the court said that a solution proposed by lawmakers, to use block grants to allocate funds, had failed to address inequities in schools. In response, the Legislature passed a bill that it said gave poorer districts a fair share of funding. Gov. Sam Brownback, a Republican, signed the measure in April.

In a 47-page ruling, the court rejected that bill, saying the Legislature’s formula “creates intolerable, and simply unfair, wealth-based disparities among the districts.”