The Supreme Judicial Court has upheld the Sept. 1 deadline for local election officials to receive mail-in primary election ballots.

The court ruled Wednesday in a lawsuit filed by Fourth Congressional District candidate Becky Grossman, who sought a 10-day extension of the period allocated for counting mail-in primary ballots.

The 22-page decision, authored by Justice Scott Kafker, comes six days before a primary where several contentious races are set to be decided including the contest between U.S. Sen. Ed Markey and U.S. Rep. Joe Kennedy III, and the race featuring a crowded field of Democrats running in the Fourth Congressional District.

At least 1 million registered voters in Massachusetts requested mail-in ballots this year under a new law aimed at boosting voting options, but questions have been raised about the law's deadlines and the reliability of the U.S. Postal Service, which has been thrust into a major role in the elections.

Kafker wrote in the decision that the existing Sept. 1 deadline is constitutional, does not interfere with the constitutional right to vote in the primary election, and provides multiple voting options. The deadline, the decision said, is "also reasonably designed to account for a number of time-sensitive legal requirements that follow shortly after the primary election."

According to the ruling, "the Legislature acted rationally when it concluded that a September 1 deadline for the receipt of mail-in ballots in the primary election was necessary to achieve the legitimate public purposes of conducting orderly primary and general elections during this particular election cycle."

Lawyers for Grossman and the secretary of state's office presented oral arguments on Monday, with the plaintiffs raising voting issues rights and the state's top election official arguing that the relief sought to count primary ballots would interfere with people's right to receive general election ballots.

Gov. Charlie Baker signed a law on July 6 that requires mail-in ballots for the Sept. 1 primary to be received by local election officials by Sept. 1. Mail-in ballots and votes case under an early voting period are already flowing into local election offices, and voters may also vote on primary day.

Grossman asked the state's highest court to order Galvin to direct local election officials to accept and count all mail-in ballots received by Sept. 11.

Under the July law, voters have until today - Wednesday, Aug. 26 - to return vote-by-mail ballot applications. The plaintiffs had argued that the window between Aug. 26 and Sept. 1 is too short and will lead to voters being disenfranchised.

Grossman said she still believes every ballot postmarked by Sept. 1 should be counted and that she was disappointed the court did not rule in her favor.

"I'm proud of the fight we waged to ensure that every vote be counted, and for everyone to be able to cast ballots without jeopardizing their health and safety," Grossman said in a statement. "I believe we all must work together to stop Donald Trump's sabotage of the post office from undermining our elections. Today's decision will not stop my work to ensure that every community in the Commonwealth is heard at the ballot box and beyond."