BUFFALO, N.Y. (AP) — Buffalo Mayor Byron Brown’s name should not appear on the November ballot, according to state and federal appellate judges who ruled against his efforts to occupy an independent party line following a loss in the Democratic primary.

The four-term mayor said he will continue his reelection efforts as a write-in candidate.

On Thursday, a state appellate court in Rochester reversed one of two orders that would have allowed Brown to appear on the independent Buffalo Party line. Later, a federal appeals court in New York City stayed the second order.

The decisions came just before Friday’s deadline for mailing overseas military ballots.

“Mayor Brown’s name will not be on the ballots that we are mailing out,” Erie County Republican Elections Commissioner Ralph Mohr said in a statement. “Each of those decisions can still be appealed.”

The mayor of New York’s second-largest city was knocked off the general election ballot when he lost the June primary to India Walton, a socialist candidate making her first run for office.

After the loss, Brown sought to qualify as the new Buffalo Party candidate for the general election, but his nominating petition was rejected because it was submitted after a state-imposed deadline had passed.

In two separate court challenges, Brown and his supporters successfully argued that the deadline, moved because of the coronavirus pandemic, was excessively early. Thursday’s action follows Walton’s appeals of the state and federal decisions that ordered the Erie County Board of Elections to put Brown’s name on the ballot.

In their four-page decision, state appellate judges from the Fourth Judicial Department in Rochester wrote that a “reasonably diligent candidate” could be expected to meet the state’s requirements for independent candidates.

Brown, they wrote, “first chose to participate in the Democratic primary election in lieu of filing a timely independent nominating petition. States are constitutionally permitted to preclude candidates who lose one primary election from subsequently running on another ballot line.”

Walton said Thursday’s decision acknowledged the Legislature’s right to set New York’s political calendar.

“If everyday Buffalonians are late on rent, parking fees, or school assignments, they face consequences. There is no reason the rules should not apply to my GOP-backed opponent as well,” she said.

A statement from Brown’s campaign manager Conor Hurley said the write-in effort will continue.

“Our campaign remains focused on what has sustained us all along, which is ensuring that Buffalo’s progress continues, and that no matter what method people vote by, that they will have the ability to cast their vote for a qualified and experienced candidate,” Hurley said.

There is no Republican candidate in the race.