A display of various size cups and sugar cubes at a news conference at New York’s City Hall. A judge struck down New York City’s groundbreaking limit on the size of sugar-laden drinks Monday.

NEW YORK — A judge struck down New York City’s ban on big sugary drinks Monday just hours before it was supposed to take effect, ruling that the first-in-the-nation measure arbitrarily applies to only some sweet beverages and some places that sell them.

“The loopholes in this rule effectively defeat the stated purpose of this rule,” state Supreme Court Justice Milton Tingling wrote in a defeat for Mayor Michael Bloomberg and a victory for the beverage industry and others who challenged the 16-ounce limit on sodas and other high-calorie drinks.

Further, the city Board of Health intruded on City Council’s authority in approving the size limit, the judge said. The restriction was supposed to start today.

The city said it will appeal the ruling as soon as possible. Supreme Court is New York’s trial-level court.

“We are confident the Board of Health’s decision will ultimately be upheld,” said Michael A. Cardozo, the city’s corporation counsel. This measure is part of the city’s multi-pronged effort to combat the growing obesity epidemic, which takes the lives of more than 5,000 New Yorkers every year, and we believe the Board of Health has the legal authority - and responsibility - to tackle its leading causes.”

The Board of Health approved the measure in September in the latest attempt by Bloomberg to improve New Yorkers’ eating habits. Previously, City Hall forced chain restaurants to post calorie counts on their menus, barred artificial trans fats in restaurant food and prodded food manufacturers to use less salt.

Restaurant inspectors had planned to start enforcing the rule in March, but city officials said they wouldn’t seek fines — $200 for a violation — until June.

City officials have called the size limit a pioneering attempt to improve public health. They point to the city’s rising obesity rate — about 24 percent of adults, up from 18 percent in 2002 — and to studies tying sugary drinks to weight gain. Care for obesity-related illnesses costs government health programs about $2.8 billion a year in New York City alone, according to city Health Commissioner Dr. Thomas Farley.

Soda makers, restaurateurs, movie theater owners and other business groups sued, arguing among other things that the measure is too limited to have a meaningful effect on New Yorkers’ waistlines.

They also complained that it would take a bite out of business for the places that have to comply, while other establishments — supermarkets and some convenience stores, for example — would still get to sell sugary drinks in 2-liter bottles and supersize cups.

Beverage makers had expected to spend about $600,000 changing bottles and labels, movie theater owners feared losing soda sales that account for 20 percent of their profits, and delis and restaurants would have had to change inventory, reprint menus and make other adjustments, according to court papers.

Critics also said the restriction should have gone before the elected City Council instead of the Bloomberg-appointed health board.