Merck & Co. suffered a significant legal setback Friday when an appeals court ruled a nationwide class action lawsuit can go forward that allows health insurers and others to sue to recover the billions of dollars they spent on Vioxx.

Merck attorney Ted Mayer called the ruling “deeply flawed” and said the company would appeal the unanimous decision by the three New Jersey Appellate Division judges to the state Supreme Court.