The Pennsylvania Supreme Court on Tuesday ruled 5-2 that a state law allowing voters to mail ballots without providing a reason is constitutional, reversing a lower court decision.

The court found that the state’s Act 77 did not violate the Pennsylvania Constitution, paving the way for voters to cast mail ballots in this year’s midterm elections and beyond.

The law, which also includes other provisions aimed at making it easier to cast a ballot, passed with bipartisan majorities in 2019.

But Republicans challenged the law in July 2021 amid former President Trump’s unfounded claims of voter fraud in the state, which included allegations related to mail ballots.

Get the latest Pennsylvania politics and election news with abc27 newsletters

In January, the lower court determined the phrase “offer to vote” in the Pennsylvania Constitution meant voters must show up to a polling place in person unless they fall into an exception. The judge’s opinion stated that a constitutional amendment was required before Act 77 could be deemed constitutional.

“We conclude that the phrase ‘offer to vote’ does not establish in-person voting as an elector qualification or otherwise mandate in-person voting,” the Pennsylvania Supreme Court ruled on Tuesday.

Instead, the court found the phrase to help define an election district residency requirement described in other parts of the state constitution.

“The legislature has the authority to provide that votes can be cast by mail by all qualified electors,” the court ruled. “The only restraint on the legislature’s design of a method of voting is that it must maintain the secrecy of the vote.”

Pennsylvania Attorney General Josh Shapiro (D), who is also running for governor, said the ruling provides “certainty” to voters that their ballot will be counted regardless of whether they cast it in person or via mail.

“After 2 years of attacks on our election system, the PA Supreme Court stated loud and clear that Act 77, which modernized our election code, is constitutional,” Shapiro said. “We must continue to stand up to attacks by those who want to pick and [choose] the laws to follow and the votes to count.”