Barrel O’ Fun, the fast-growing Minnesota maker of salty snacks from corn chips to popcorn, was assessed hundreds of thousands of dollars in surcharges and fines because its production facility in Perham, Minn., for several years discharged poorly treated wastewater at overwhelming levels, according to state pollution regulators.

The stench from the city’s wastewater treatment ponds was so pungent, according to the Minnesota Pollution Control Agency (MPCA), that citizens in the west-central Minnesota town complained that they couldn’t open their windows or leave their laundry to dry on the clothesline. Others said the stink made them ill, the agency added.

Along with paying a $45,000 fine levied by the MPCA, Barrel O’ Fun was assessed surcharges from the city of more than $850,000 for exceeding maximum limits on wastewater discharge in 2011, 2012 and 2013, according to municipal records.

However, KLN Family Brands, Barrel O’ Fun’s parent company, and the city agreed that the surcharges would be waived in lieu of the company making the necessary capital improvements.

Barrel O’ Fun “has completed several actions to comply with wastewater pollutant limits agreed upon with the city,” the MPCA said Wednesday in a statement announcing the fine.

The MPCA also pinned some of the responsibility for the odor-producing pollution on the city, saying that its officials “failed to adequately regulate wastewater discharges” from Barrel O’ Fun and KLN Family Brands’ Kenny’s Candy and Tuffy’s Pet Foods, as well as Perham Egg.

The agency fined the city $70,000 in 2013, and KLN agreed to pay that penalty as part of the deal to have the surcharges go toward the capital improvements.

In 2013, the MPCA found enough corn pieces in the company’s wastewater to obstruct flow in the city’s wastewater treatment facilities. During upgrades to the facilities, a mound of corn more than 3 feet high was found and removed from an area around inlet pipes.

“As we grew, the city has not been able to grow quite as fast as we have,” KLN founder Kenny Nelson said in an interview Thursday with the Star Tribune.

Nelson added that the city now has a “phenomenal” new facility to handle the discharge amounts.

The excessive discharges from Barrel O’ Fun were first detected in 2009 and at times were 2½ times what was allowed, the MPCA said.

In December 2013, the company’s average daily discharge “left no remaining capacity for any city resident or other business,” according to the stipulation agreement reached between the company and the agency that called for the $45,000 fine. This type of agreement is a regulatory tool used to achieve compliance with environmental laws.

Barrel O’ Fun explained to the MPCA in the agreement that it has “experienced significant growth in operations over the past years” and has spent more than $700,000 in the past fiscal year upgrading its wastewater pretreatment capabilities. It also stated that it employs nearly 900 people in a city of about 3,000.

Barrel O’ Fun “has made no intentional violation of its discharge limits,” the company said in the agreement, “and reasonably believes that the exceedances noted were the result of inadvertent activities and administrative oversights regarding update of discharge limits and pretreatment practices that did not keep up with the facility’s growth.”