Research animal breeder Envigo pleaded guilty to animal welfare and environmental crimes on Monday, resolving a two-year US justice department investigation into its mistreatment of thousands of beagles, prosecutors said.

Envigo agreed in federal court in the western district of Virginia to pay $22m in fines, plus an additional $13.5m to support animal welfare and environmental projects, cover law enforcement expenses and improve its own facilities.

That includes the largest-ever fine in an animal welfare case imposed by the justice department: $11m, the US attorney for the western district of Virginia said.

Envigo made headlines in 2022 when it forfeited some 4,000 beagles, some of which were adopted by celebrities including Meghan Markle and Prince Harry. It pleaded guilty to one misdemeanor count of conspiring to violate the Animal Welfare Act and one felony count of conspiring to violate the Clean Water Act after it refused to fix its wastewater treatment equipment and allowed excess animal feces to be discharged into a nearby creek.

The company is also required to both retain an independent corporate monitor as well as make a statement expressing contrition.

Envigo, which was acquired by Inotiv in November 2021, is one of the leading suppliers of animals for medical research in the United States. Its clients include major pharmaceutical companies, universities and the federal government.

The guilty plea over the Clean Water Act violation could lead the Environmental Protection Agency (EPA) to strip away Envigo’s status as a federal contractor.

Federal investigators in May 2022 executed a search warrant at Envigo’s facility in Cumberland, Virginia, amid concerns about its mistreatment of thousands of beagles.

The seizure of the beagles came after inspectors with the US department of agriculture’s animal and plant health inspection service repeatedly documented dozens of violations at Envigo in 2021 and 2022.

Problems included dangerous flooring, failing to provide veterinary care, unsanitary conditions, euthanizing dogs without anesthesia, under-feeding mothers nursing puppies and failing to document the cause of death for hundreds of puppies.

In court filings, prosecutors said on Monday that the company refused to fire a veterinarian referred to only as “AV”, despite repeated complaints by employees – including concerns that AV mishandled the surgeries of five dogs.

“Staff rejection of AV’s authority paired with AV’s inadequate veterinary skills led to multiple additional improper and inadequate veterinary practices at the Cumberland Facility,” prosecutors wrote in the charging documents.

The company ceased operations at the Cumberland facility on 24 January and is no longer breeding or selling dogs.

The veterinarian resigned from the company in April 2022, according to the court filings.

Prosecutors also said the company conspired with others to avoid spending money to upgrade its wastewater system while it continued to breed and sell beagles despite being unable to manage the waste disposal.

The justice department previously subpoenaed US agriculture department inspectors and managers to appear before a grand jury to question them about why the agency took no enforcement action against Envigo despite the history of violations.

Two of the top managers who oversaw the inspections have since left the agriculture department, and no one from the agency has been charged with wrongdoing.