(CNN) -

New York's Court of Appeals ruled Thursday that New York City's ban on large sugary drinks, which was previously blocked by lower courts, is illegal.

"We hold that the New York City Board of Health, in adopting the 'Sugary Drinks Portion Cap Rule,' exceeded the scope of its regulatory authority," the ruling said.

Former New York City Mayor Michael Bloomberg had pushed for the ban on sugary drinks larger than 16 ounces as a way to fight obesity and other health problems.