A panel of three federal judges in Michigan ruled Thursday that the state’s legislature unfairly drew up state and congressional districts and must come up with new boundaries.

The lawsuit was filed by the League of Women Voters of Michigan and alleged that Republicans in the state legislature had purposely drawn up districts that disadvantage Democratic candidates.

The three judges said in their ruling that 27 of the 34 challenged districts violated the plaintiffs’ First and 14th Amendment rights “by diluting the weight of their votes.” The judges also found every one of the districts challenged violated the plaintiffs’ First Amendment right to association.

“This court joins the growing chorus of federal courts that have, in recent years, held that partisan gerrymandering is unconstitutional,” the judges wrote in their opinion.

Lawmakers in the Republican-held state legislature must now draw up new maps that will be amicable enough to be approved by Democratic Gov. Gretchen Whitmer. According to the court, Whitmer must sign off on the new maps before Aug. 1, or the court will draw the new maps itself.