Three of the country's largest pharmacy chains were ordered to pay $650.6 million by a federal judge after being found to have flooded with prescription painkillers. The court said in a landmark judgment on Wednesday that some of the cost of the opiate epidemic must be paid by drugstores.

The award came after a first-of-its-kind federal trial targeting the three major retailers, which have some of the deepest pockets left in the legal battle over the epidemic. Drug distributors and makers have filed for bankruptcies.

A jury found last year that the pharmacy played a significant role in the crisis.

The retailers will have to create a hotline for patients and employees to report inappropriate sales of painkillers, as well as appoint a controlled-substance compliance officer to review prescription-validation processes.

According to the Centers for Disease Control and Prevention, half a million Americans have died from the opiate epidemic since 1999. A federal judge in San Francisco ruled that Walgreens was to blame for the city's opiate epidemic.

Federal law requires that prescriptions be filled before they are used. Attorneys for the blue-collar counties in Ohio argued that the retailers oversupplied them with more pills than they needed. Every man, woman and child in Lake County will get at least one pill from a pharmacy between 2012 and 2016 according to estimates by lawyers.

The pharmacy blamed the doctors for overprescribing.

Walmart said that the ruling was rife with legal errors and that the counties were looking for deep pockets. They plan to appeal.

The real causes of the opiate crisis, like pill mill doctors, illegal drugs and regulators asleep at the switch, were not addressed by the lawyers.

The decision was called a misuse of public nuisance law by the company.

The statement said they disagreed with the court's decision regarding the counties' abatement plan. Drug Enforcement Administration-licensed doctors who prescribe legal, FDA-approved substances to treat actual patients in need are filled by pharmacists.

Walgreens did not reply immediately.

The expert who testified for the counties estimated that it would cost about $3.3 billion to recover from the epidemic, although the judge accepted that some abuse and addiction would have occurred even without retailers involvement. Over the next 15 years, Polster ordered the pharmacies to pay more than 300 million dollars to the two counties.

Walgreens agreed to pay $620 million to the state of Florida as a whole.

The court recognized the epidemic as a public health crisis. Lake County Commissioner John Plecnik said in a statement that the decision held Big pharma accountable for the harm and deaths caused by the overselling of Opioids. The legal precedent that Lake and Trumbull Counties have won together will set the stage for the rest of the nation and help end the Opioid Epidemic.