The bitter, four-year dispute between Cobb Electric Membership Corp. and its customers, who said the utility owed them 40 years worth of dividends, ended on Tuesday with the largest legal settlement in Cobb County history — $98 million going to hundreds of thousands of current and former co-op members and their attorneys.

The Marietta-based utility was sued in 2010 over profits that should have been returned to members over the past four decades, but instead were diverted for other purposes, including naming rights of a performing arts center and the utility’s for-profit subsidiary businesses.

The diversion to some of the subsidiaries by one of the state’s largest electric co-ops led to a racketeering indictment in 2011 against Dwight Brown, the EMC’s former chief executive, who is accused of indirectly enriching himself through his stock in Cobb Energy — a for-profit company set up to run the co-op under a long-term contract. Brown appealed his indictment to the Georgia Court of Appeals earlier this year. The appellate court has not ruled.

An army of attorneys represented the various sides in the EMC lawsuit: three represented the 177,000 current members; nine represented the more than 500,000 past members; and three represented the EMC. Together, they will divvy up $19.8 million of the settlement amount.

Former Georgia Attorney General Mike Bowers led the parties through years of nasty mediation, which became “trench warfare at its worst,” according to Cobb Superior Court Judge Steve Schuster, who signed off on the settlement.

Bowers agreed with that.

“I have never mediated as contentious a case as this one … Every single session was a dog fight,” Bowers said. “People were trying to get at each other’s throats. It was hard-fought every inch of the way.”

Members of the state’s 42 electric membership corporations typically receive money back at the end of the year based on the amount of profit earned by the utility, and the amount of electricity used by the individual.

Members of the Cobb EMC were given the choice of receiving the full amount of money owed, paid out over 20 years, or accepting a lesser, lump-sum payment.

The biggest winner in the settlement is the Cobb County School District, which took a $1.8 million lump sum. Cobb County government got the second-largest lump-sum settlement amount at $1.6 million.

School Board Chairwoman Kathleen Angelucci said her board decided to pass on $5.1 million over 20 years because the district, which is facing an $80 million deficit, needs the money immediately. She said it is unclear exactly how the money will be used.

“With the current financial situation we’re in, that money will benefit the district now,” Angelucci said. “There are a lot of things that need our attention.”

There’s also a long list of nonprofit organizations that will pocket cash. The YMCA of Cobb County qualifies for a $38,400 lump-sum payment, while Trinity Chapel Church of God in Powder Springs is set for an $18,500 payout.

Kevin Moore, an attorney for the Cobb EMC, said the vast majority of payouts are small amounts, like $30 or $50, to individuals. He said the settlement was made possible after new management at the EMC fired its previous lawyers and instructed his firm to “do right by the members.”

“These are dollars going to nonprofit organizations that will turn around and put that money right back in the community,” Moore said.

Judge Schuster said the settlement allows the EMC to “move forward with a clean balance sheet,” which makes it a “much stronger company.” He praised the attorneys for treating “the $15 claim the same as the $5 million claim.”

“Everyone is walking out of this courtroom a winner,” he said. “Whoever thought this day would come?”