Lawyers with the city’s Law Department said they planned to appeal the decision.

The city’s health department created the rule in late 2009. In June, the nation’s three biggest tobacco companies  Philip Morris, Lorillard and R. J. Reynolds  joined forces with the New York State Association of Convenience Stores in filing a lawsuit challenging the rule. In their suit, the tobacco companies and convenience stores said the rule violated the First Amendment rights of retailers who disagreed with the message, and breached a law stating that only the federal government can regulate cigarette warnings and advertising.

In his ruling, Judge Rakoff said that health officials had good reason to view smoking as a “public health threat,” citing smoking as the leading cause of preventable death in New York City and the rest of the country. “Within New York City, roughly 7,500 people die from smoking annually  more than from AIDS, homicide and suicide combined,” he wrote.

But Judge Rakoff also cited a federal law enacted in 1965, the Labeling Act, which gave the federal government exclusive authority over cigarette warnings. That law, he wrote, seeks to balance public and commercial interests: the federal government protects the public, but also sets clear and uniform cigarette regulations that protect “commerce and the national economy.”

In his ruling, Judge Rakoff pointed out that the Labeling Act also contained a provision forbidding any state laws from conflicting with the federal government’s policies on cigarette warnings and advertisements. That, he concluded, makes the city’s placard policy illegal.

Floyd Abrams, a lawyer who represented the convenience store association, said that even though the city had agreed not to enforce the rule until this weekend, many retail shops had put up the graphic placards anyway. He said he was “very pleased” with Judge Rakoff’s decision.