NEW YORK (Reuters) - FedEx Corp will pay $35.4 million to settle three lawsuits in which New York state and New York City accused the company of shipping millions of untaxed cigarettes to residents over a decade.

FILE PHOTO: A FedEx Office logo is pictured in Times Square in the Manhattan borough of New York, New York, U.S. April 2, 2017. REUTERS/Carlo Allegri

The settlement announced on Monday came after a judge ruled last Oct. 15 that FedEx had knowingly violated a federal anti-cigarette trafficking statute, and a 2006 agreement with the state not to ship cigarettes to people’s homes.

New York officials said FedEx’s conduct undercut their efforts to protect public health by curbing smoking, and cheated the state and city out of tax revenue from cigarette sales.

They said FedEx knowingly shipped cigarettes on behalf of such companies as Kentucky-based Cigarettes Direct To You and Long Island-based Shinnecock Smoke Shop.

“Not only did FedEx violate laws created to protect the public from the serious health risks associated with cigarettes, but they also swindled New York City and State out of millions of dollars in tax revenue,” state Attorney General Letitia James said in a statement.

Zachary Carter, New York City’s corporation counsel, accused FedEx of shipping cigarettes “for the worst of reasons --profit.”

The settlement agreement requires Memphis, Tennessee-based FedEx to stop domestic shipments of cigarettes with “limited” exceptions, punish workers who knowingly arrange such shipments, and hire an independent consultant to monitor its compliance.

FedEx did not admit or deny wrongdoing in entering the two-year agreement, which can be extended upon a material breach.

The company had no immediate additional comment.

In the Oct. 15 ruling, U.S. District Judge Edgardo Ramos in Manhattan said it was “beyond doubt that certain FedEx employees knew that FedEx was shipping unstamped cigarettes,” and held the company responsible for that knowledge.

The settlement came after U.S. District Judge Katherine Forrest in Manhattan ordered United Parcel Service Inc in May 2017 to pay the state and city $247 million in damages and penalties in a similar case.

A federal appeals court will in March consider UPS’ appeal of that award, which the company said resulted from a “cavalcade of errors” by Forrest, who is now in private practice.

Cigarette prices in New York are among the highest in the United States.

New York City last year set a minimum price of $13 per pack, and this month banned cigarette sales at pharmacies.