Opponents of Mayor Michael Bloomberg’s plan to ban sodas over 16 ounces, which was set to take effect Tuesday, can rejoice after a state judge invalidated the policy.

The ban would have outlawed sugary drinks over 16 ounces in restaurants, movie theaters and other places regulated by the city’s health department.

The controversial policy from the health-conscious New York City mayor suffered a setback when New York Supreme Court Judge Milton Tingling invalidated the ban Monday.

In his decision, Tingling ruled that the soda ban is “fraught with arbitrary and capricious consequences,” and that it would be easy to get around the policy (buying two 8-ounce drinks, for example).

“The simple reading of the rule leads to the earlier acknowledged uneven enforcement even within a particular city block, much less the city as a whole …. the loopholes in this rule effectively defeat the state purpose of the rule,” he wrote, the Wall Street Journal reported.

The soda ban was highly controversial in New York.

About 51 percent of New Yorkers opposed Bloomberg’s policy while 46 percent were in favor, according to a poll released late last month by Quinnipiac University.