DETROIT (AP) — A judge on Tuesday blocked a sudden ban on the open display of guns near Michigan polling places on Election Day.

Judge Christopher Murray acted just a few hours after hearing a challenge from gun-rights groups. They said Secretary of State Jocelyn Benson, a Democrat, had exceeded her authority this month in banning people from openly carrying guns within 100 feet of polling places.

Critics argued that Benson failed to go through a formal rule-making process as required under state law. Murray agreed.

Compliance “is no mere procedural nicety,” the judge said. “Instead, our appellate courts have repeatedly emphasized the importance of the democratic principles embodied in the (law), which requires notice and an opportunity to be heard on the subject under consideration.”

Earlier in the day, Assistant Attorney General Heather Meingast said lawmakers have given secretaries of state discretion to set certain election rules. She said Benson acted after authorities recently busted up an alleged plot to kidnap Gov. Gretchen Whitmer.

Armed critics upset with Whitmer’s orders about controlling the coronavirus have rallied at the Capitol.

“There are dozens — we’ve had numerous complaints,” Meingast said. “There are voters who are afraid. There are election workers who are afraid to go to work on Election Day.”

Attorney General Dana Nessel, a Democrat, pledged to appeal Murray’s decision with just days left until the election.

Murray hears lawsuits against the state as a judge on the Court of Claims. He also is chief judge on the Michigan appeals court and is running for reelection to that court.