The Supreme Court of Virginia invalidated a voter-approved redistricting referendum on Friday, ruling that lawmakers failed to follow the constitutional process required to place the measure on the ballot and halting Democrat-led efforts to implement a new congressional map.

The majority held that lawmakers acted too late when they approved the amendment proposal after more than a million early ballots had already been cast in last year’s Virginia elections, according to the decision released Friday morning. The state constitution requires the legislature to vote on any proposed constitutional amendments in two stages with an election in between to give voters the opportunity to hold their representatives accountable if they don’t like the proposed amendment, and the state Supreme Court found that Virginia Democrats did not follow that process.

The decision resolves a high-stakes legal fight over whether the Democrat-controlled General Assembly complied with the Virginia Constitution when it moved to place the amendment before voters in a special election last month, and means Virginia will keep the map that is favorable to Republicans in five of its congressional districts.