NEW YORK — A judge struck down New York City’s pioneering ban on big sugary drinks Monday hours before it was supposed to take effect, handing a defeat to health-minded Mayor Michael Bloomberg and creating confusion for restaurants that already had ordered smaller cups and changed their menus.

State Supreme Court Justice Milton Tingling said the 16-ounce limit on sodas and other sweet drinks arbitrarily applies to only some sugary beverages and some places that sell them.

“The loopholes in this rule effectively defeat the stated purpose of this rule,” Tingling wrote in a victory for the beverage industry, restaurants and other business groups that called the rule unfair and wrong-headed.

In addition, the judge said the Bloomberg-appointed Board of Health intruded on the City Council’s authority when it imposed the rule.

The city vowed to appeal the decision, issued by New York state’s trial-level court.

“We believe the judge is totally in error in how he interpreted the law, and we are confident we will win on appeal,” Bloomberg said.

He added that the city would emphasize to higher courts “that people are dying every day. This is not a joke.”

“The court ruling provides a sigh of relief to New Yorkers and thousands of small businesses in New York City that would have been harmed by this arbitrary and unpopular ban,” the American Beverage Association and other opponents said.

While some eateries had held off making changes because of the court challenge, some restaurants had begun using smaller glasses for full-sugar soda. Dunkin’ Donuts shops have been telling customers they will have to sweeten and flavor their own coffee.

Frames Bowling Lounge developed — and is keeping — a slate of fresh-squeezed juices as an alternative to pitchers of sodas for family parties.

“All that cost a lot of money — but you have to go with the flow,” executive general manager Ayman Kamel said.

Bloomberg urged businesses to comply despite the court ruling, and not just because the city may yet prevail.

“If you know what you’re doing is harmful to people’s health, common sense says if you care, you might want to stop doing that,” he said.

The first of its kind in the country, the restriction has sparked reaction from pizzeria counters to late-night talk shows.

Under Bloomberg’s 11 years in office, the city has compelled chain restaurants to post calorie counts, barred artificial trans fats in restaurant food and prodded food manufacturers to use less salt.

The city has successfully defended some of those initiatives in court.

Because of the limits of city authority and exemptions made for other reasons, the ban on supersize beverages doesn’t cover alcoholic drinks or many lattes and other milk-based concoctions, and it doesn’t apply at supermarkets or many convenience stores.

The health board has considerable regulatory power, but its limits will likely be a central question in the appeal.

“I think it turns on whether the appellate division feels that the mayor has gone too far in ruling by decree in bypassing City Council,” said Rick Hills, a New York University law professor who has been following the case.

Critics said the measure is too limited to have a meaningful effect on New Yorkers’ waistlines. And they said it would take a bite out of business for the establishments that have to comply, while other places would still be free to sell sugary drinks in 2-liter bottles and supersize cups.

What’s next

“We plan to appeal the decision as soon as possible, and we are confident the Board of Health’s decision will ultimately be upheld,” Michael Cardozo, the Bloomberg administration’s chief counsel, said in a statement.

More in News

A wedding and special events’ planning business has agreed to pay a $200,000 settlement to five employees living in the country illegally after allegedly failing to pay them minimum wages and overtime and discriminating against them because of their race.

The CIA has concluded in a secret assessment that Russia intervened in the 2016 election to help Donald Trump win the presidency, rather than just to undermine confidence in the U.S. electoral system, according to officials briefed on the matter.