Los Angeles County and California state elections officials hailed a Supreme Court ruling Monday that they said validates the process of accepting mail-in ballots that arrive a certain number of days after Election Day.

The 5-4 ruling on an issue that has been a persistent target of President Trump rejected an attack on laws in more than half the states that allow mail-in ballots that arrive Election Day and still be counted, as long as they’re postmarked by Election Day. At stake were election rules for the upcoming mid-term contests in California and about two dozen other states that offer more forgiving voting deadlines.

California law allows ballots to be received within seven days after Election Day, provided they are postmarked on time.

“Today’s decision affirms what Los Angeles County voters deserve: the assurance that a ballot cast by election day will be counted if received within the legal timeframe established in state law,” Los Angeles County Registrar-Recorder/County Clerk Dean Logan said in a statement. “The decision supports California voters’ preference for voting options that increase access and participation. Our office will continue to provide voter education, multilingual outreach, and leverage available resources to ensure voting access for our 5.8 million registered voters heading into November and in every election that follows. We remain firmly committed to transparency, accuracy, and compliance with all applicable election laws.”

In a statewide election, between 700,000 and 1 million vote-by-mail ballots are returned on or around Election Day in Los Angeles County, according to the county elections office. There are more than 5.8 million registered voters in Los Angeles County, the largest voting jurisdiction in the country.

The ruling requires no changes to state election laws. In California, all of the state’s 23 million registered voters are sent vote-by-mail ballots ahead of elections, a practice that began during the Covid-19 pandemic to expand voting options.

California Secretary of State Shirley Weber called the court’s ruling a win for voters, the rule of law and democracy.

“By rejecting efforts to shorten the vote-by-mail return window, the court protected an important safeguard that helps ensure service members, overseas voters, Californians with disabilities, and rural communities are not silenced by mail delays beyond their control,” Weber said in a statement. “This ruling makes one thing clear: our elections belong to the people, not to partisan agendas. As secretary of state, I will keep working to ensure every eligible Californian has the opportunity to be heard, because our democracy is strongest when every voice and vote count.”

Trump called the court’s decision a “tremendous loss” for voter rights, and again called on Congress to pass the Save America Act, which would ban most mail-in voting except for specific circumstances, while requiring all voters to produce a photo ID and proof of citizenship to cast a ballot. Save America Act legislation would, among other things, limit who is able to receive a mail ballot and impose a documentary proof-of-citizenship requirement for registering to vote.

“If we want fair and secure elections, Election Day should mean exactly what it says, which is why this decision makes it even more imperative that Congress pass the SAVE America Act,” RNC Chairman Joe Gruters said in a statement.

Justice Amy Coney Barrett wrote the court’s majority opinion, joined by Chief Justice John Roberts and the three liberal justices. Justice Barrett wrote that federal laws “leave open” votes must be received.

Congress could change the law, she said.

“If varied deadlines for ballot receipt similarly call for a national solution, the American people must choose it through their elected representatives,” Barrett wrote.

Justice Samuel Alito wrote the dissent for four justices.

“Not only is today’s decision inconsistent with statutory text, legal context, historical practice, and precedent; it also threatens to produce lamentable consequences,” Alito wrote. “The majority’s holding spawns a slurry of troubling election-law questions and risks further undermining Americans’ confidence in election integrity.”

The court heard arguments in March in a case from Mississippi pitting the state against Trump’s Republican administration and the Republican and Libertarian parties. At issue was whether federal law sets a single Election Day that requires ballots to be both cast by voters and received by state officials.

The federal appeals court in New Orleans struck down a Mississippi law allowing ballots to be counted if they arrive within five business days of the election and are postmarked by Election Day.

The outcome is a “sigh of relief” for a lot of election administrators, said Stephen Richer, a Republican and the former top election administrator in Arizona’s Maricopa County, which includes Phoenix.

A ruling in favor of the Republican National Committee “would have created a whole host of administrative challenges for the affected states,” said Richer, who is now a legal fellow at the Cato Institute.

RNC officials did not immediately respond Monday to email and telephone requests for comment.

Gov. Gavin Newsom also hailed the decision.

“California, like many states, utilizes vote-by-mail to increase participation in our democracy and today’s ruling helps ensure mail-in-ballots get counted and people’s voices are heard through the democratic process,” Newsom said. “Despite ongoing attacks from the Trump Administration, we will continue our work throughout the Golden State to ensure every eligible Californian participates — because democracy is strongest when we all take part.”

The Associated Press contributed to this report.