The U.S. Supreme Court has upheld a Mississippi law that allows election officials to count mail-in ballots that are postmarked by Election Day but received up to five days after it.

The court’s ruling means state laws that allow ballots to be received after Election Day can stand.

In a surprise decision across ideological lines, the Supreme Court is saving a grace period for ballots received after Election Day.