DeCoster Egg Farms has agreed to pay $2 million in fines to settle citations brought last summer for health and safety violations.

The Occupational Safety and Health Administration had proposed penalties totaling more than $3.8 million and officials said DeCoster will have to pay the full amount if it fails to meet standards set out in the agreement.

DeCoster also agreed to pay $21,000 to settle claims brought by the government for wage and hour violations involving 105 of its workers, the U.S. Department of Labor said.

The settlement was announced less than two months after the department's civil case was about to go to trial before an administrative law judge. That proceeding was postponed as the two sides negotiated.

The department issued the citations last summer after a six-month OSHA investigation into DeCoster's farm in Turner, Maine. Then-Labor Secretary Robert B. Reich likened conditions to those at big-city sweatshops.

Current Secretary Alexis M. Herman agreed, citing such violations as unguarded machinery, electrical hazards, exposure to harmful bacteria and other unsanitary conditions that she characterized as "simply atrocious."

Descriptions of squalid conditions at the farm and at housing units it provided for workers triggered boycotts of DeCoster eggs by several large supermarket chains.

Austin J. DeCoster, owner of the farm that is a big producer of brown eggs, said most problems have been corrected and some areas exceed OSHA standards.

If the compliance rate of standards set in the settlement falls below 90 percent, DeCoster will have to pay the remaining $1.8 million in penalties. An independent consultant will make an unannounced inspection at the farm within a year.