A gun show expected to draw thousands of attendees to an expo center in Fairfax County this weekend was canceled Thursday after a judge ruled the organizers had to adhere to the state’s newly tightened coronavirus restrictions.

The three-day “Nation’s Gun Show” was scheduled to begin Friday at the Dulles Expo Center in Chantilly but would have had to operate under new capacity restrictions — limiting the crowd to 250 people at a time — that Virginia Gov. Ralph Northam (D) implemented in response to a surge in infections.

In a lawsuit filed earlier this week, the show’s organizer, Showmasters Inc., said the tighter rules, which went into effect Monday, violate gun owners’ rights and would lead to financial hardships for vendors arriving from as far away as Texas after several months of planning for the event.

They argued the expo center should be reclassified as a “brick and mortar establishment,” which has no capacity limits and is required to follow only physical distancing and mask-wearing mandates under Northam’s pandemic plan.

“Isn’t a Walmart just a 24-hour-a-day, seven-day-a-week exposition of goods to be sold?” David G. Brown, an attorney for Showmasters, argued during a Thursday court hearing. “There’s no difference.”

Fairfax Circuit Court Judge Brett A. Kassabian disagreed. He ruled that Northam has the authority to regulate crowd sizes during the pandemic and that the restrictions would not prevent the gun show from going forward if its organizers abide by them.

Kassabian said the attempt to reclassify the expo center as a “brick and mortar establishment” was “a stretch” and sided with the office of Attorney General Mark R. Herring (D) in characterizing the gun show as a potential “superspreader” event. A gun show the organizers held at the same location in August drew 12,500 attendees, the group said in a court filing.

“To allow thousands to roam unchecked during the middle of the most serious health crisis that this country has suffered in the past 100 years is not in the public interest,” Kassabian said during the hearing.

Northam’s new restrictions also require restaurants to stop serving alcohol at 10 p.m. and to close at midnight, lower the age limit on the state’s mask mandate to apply to children older than 5 and limit crowds at private events — indoors or outside — to 25 people.

The governor made those changes in response to a prolonged surge of coronavirus infections in the state, including in Fairfax. On Thursday, the state’s seven-day average for new cases reached 1,823, another record, while the positivity rate for tests was 7.1 percent, part of a steady climb toward the state’s threshold of 10 percent for infection rates that could prompt even tighter restrictions.

After the ruling, Showmasters announced the event would be canceled.

“We are very sorry for the incredible financial burden and terrible inconvenience this is inflicting on all involved,” the group said in a statement posted to the event’s website.

Herring (D) applauded the judge’s ruling.

“Putting hundreds or even thousands of Virginians at risk for the sole purpose of selling guns is just not worth it,” the attorney general said on Twitter.