The Iowa Supreme Court has ordered the city of Des Moines to refund a portion of the franchise fee it collects on gas and electricity bills, upholding a district court judge who ruled some of the fees are unlawful.

The Supreme Court on Friday also upheld the lower court's ruling that the case can be certified as a class-action lawsuit to include all Des Moines utility customers.

The court decided most of the 5 percent franchise fee the city of Des Moines charged utility customers between 2004 and 2009 was illegal.

In a dissenting opinion, Chief Justice Mark Cady said, "The judgement is so large that the city will now need to raise additional revenue or reduce city services to refund the improper fee to all the residents who paid it."

Cady essentially said the citizens of Des Moines were suing themselves, saying, "There is little utility in suing yourself, especially when the associated attorney fees and litigation expenses of suing yourself will run into the millions of dollars. Most people would be unwilling to pursue litigation under such circumstances."

The refund has been estimated to be about $40 million. Des Moines residents who paid their MidAmerican Energy bills between 2004 and 2009 can expect a refund of hundreds of dollars from the city.

The case revolves around permissible uses of franchise fees.

The court said the city can include the value of trees that must be removed or trimmed for electrical line access but should not recoup money for some other costs.

Attorneys estimate refunds will be in the hundreds of dollars for individual homeowners. They said they will be pushing for checks, but the city could ask the court for a variety of other methods of repayment, including but not limited to credits for city services, free admission to the swimming pools or checks paid in installments over several years.

Attorneys for the plaintiff declined to estimate their fees for the approximately eight years of litigation.

The attorneys said the city needs to be held accountable for charging an illegal tax and this decision is a way to hold the city accountable so that they don't overreach again.