WASHINGTON — Major tobacco companies that spent decades denying they lied to the U.S. public about the dangers of cigarettes must spend their own money on a public advertising campaign saying they did lie, a federal judge ruled on Tuesday.

The ruling sets out what might be the harshest sanction to come out of a historic case that the Justice Department brought in 1999 accusing the tobacco companies of racketeering.

U.S. District Judge Gladys Kessler wrote that the new advertising campaign would be an appropriate counterweight to the companies’ “past deception” dating to at least 1964.

The advertisements are to be published in various media for as long as two years.

Details of the campaign — like how much it will cost and which media will be involved — are still to be determined and could lead to another prolonged fight.

Kessler’s ruling on Tuesday, which the companies could try to appeal, aims to finalize the wording of five different statements the companies will be required to use.

One of them begins: “A federal court has ruled that the defendant tobacco companies deliberately deceived the American public by falsely selling and advertising low tar and light cigarettes as less harmful than regular cigarettes.”

Another statement includes the wording: “Smoking kills, on average, 1,200 Americans. Every day.”

The wording was applauded by health advocates who have waited years for tangible results from the case.

“Requiring the tobacco companies to finally tell the truth is a small price to pay for the devastating consequences of their wrongdoing,” said Matthew Myers, president of the Campaign for Tobacco-Free Kids, an anti-tobacco group in Washington.

“These statements do exactly what they should do. They’re clear, to the point, easy to understand, no legalese, no scientific jargon, just the facts,” said Ellen Vargyas, general counsel for the American Legacy Foundation, which is known for its “Truth” advertising campaign that began in 2000 and was credited with curbing smoking by the young.

The largest cigarette companies in the United States spent $8.05 billion in 2010 to advertise and promote their products, down from $12.5 billion in 2006, according to a report issued in September by the Federal Trade Commission.

The major tobacco companies, which fought having to use words like “deceived” in the statements, citing concern for their rights of free speech, had a muted response.

“We are reviewing the judge’s ruling and considering next steps,” said Bryan Hatchell, a spokesman for Reynolds American Inc.

Philip Morris USA, a unit of Altria Group Inc, is studying the decision, a spokesman said.

A spokesman for a third major defendant, Lorillard Inc , had no immediate comment.

The Justice Department, which urged the strong language, was pleased with the ruling, a spokesman said.

Kessler’s ruling considered whether the advertising campaign — known as “corrective statements” — would violate the companies’ rights, given that the companies never agreed with her 2006 decision that they violated racketeering law.

But she concluded the statements were allowed because the final wording is “purely factual” and not controversial.

She likened the advertising campaign to other statements that U.S. officials have forced wayward companies to make.

The Federal Trade Commission, she wrote, once ordered a seller of supposed “cancer remedies” to send a letter on its own letterhead to customers telling them the commission had found its advertising to be deceptive.

“The government regularly requires wrongdoers to make similar disclosures in a number of different contexts,” Kessler wrote.

Early in the long-running case, the Justice Department hoped to extract $280 billion from the companies to pay for a smoking cessation program and other remedies.

It later dropped the demand to $14 billion, and then Kessler ruled she could not force them to pay for such a program at all.

When Kessler first ordered the advertising campaign in 2006 — setting off six years of debate on the wording — the statements were to run on major television networks, on cigarette packaging, as full-page newspaper ads and on corporate websites.

The idea was to “structure a remedy which uses the same vehicles which defendants have themselves historically used to promulgate false smoking and health messages,” she wrote then.

But in the years since, “the types of media in which defendants convey commercial messages of this nature have changed dramatically,” Kessler wrote on Tuesday.

Perhaps, she added, the ads should also be in the online versions of newspapers.

Analysts who follow tobacco companies declined to comment on Tuesday’s ruling, saying it would be hard to estimate the impact of the court-ordered advertising campaign until all of the details are known.

Vargyas, of American Legacy, is expecting a drawn-out fight.

“The tobacco companies will appeal absolutely everything,” she said.

The case is USA v. Philip Morris USA, et al, U.S. District Court for the District of Columbia, No. 99-cv-02496.

Separately, tobacco companies are battling in court with the U.S. Food and Drug Administration (FDA) over the warning labels on tobacco products. The FDA has proposed new graphic warning labels — one of which includes a photo of a man with a hole in his throat — that companies consider a free speech violation.