EAST ST. LOUIS, Ill. (AP) — Insurance giant State Farm on Tuesday reached a $250 million preliminary settlement in a federal class-action lawsuit claiming the company funneled money to the campaign of an Illinois Supreme Court candidate.

The lawsuit filed in U.S. District Court in East St. Louis alleged Bloomington-based State Farm secretly funneled money to the campaign of Supreme Court Chief Justice Lloyd A. Karmeier while he was a candidate for the high court in 2004.

In the 2005 case of Avery v. State Farm, Karmeier cast the deciding vote to reverse a $1.06 billion judgment in 1999 against State Farm for its use of aftermarket car parts in repairs. The court ruled the nationwide plaintiff class was improperly certified by a Williamson County trial judge. It also contended using aftermarket parts was not a breach of State Farm policyholders’ contracts.

The class-action lawsuit sought nearly $10 billion from State Farm in a trial that was scheduled to begin Tuesday. The plaintiffs alleged State Farm covertly supported Karmeier’s campaign in order to secure his win and reversal of the Avery lawsuit decision.

U.S. District Judge David Herndon of the Southern District of Illinois certified the lawsuit’s class action status last year. The class representative, Mark Hale, is a New York resident.

In a joint statement issued by State Farm and the plaintiffs, the insurance company said it agreed to settle with the plaintiffs because both believe “it is in the best interest of all the parties and to avoid protracted litigation and appeals that could continue for several more years.”

Despite the settlement, State Farm continues to deny any liability. In its statement, the company said it considers the claims in the lawsuit “without merit.”

As a part of the settlement, the lawsuit’s plaintiffs agreed to dismiss, upon final approval, their Racketeer Influenced and Corrupt Organizations claims and unjust enrichment claims.

The lawsuit claimed millions of dollars were funneled through donations to the U.S. Chamber of Commerce, which then sent the money to a political action committee and the Illinois Republican Party for use in Karmeier’s 2004 campaign.

Karmeier and his Democratic opponent, Gordon Maag, spent a combined $9.3 million in their battle for the southern Illinois seat on the Supreme Court. It was the most expensive judicial race in American history at the time, experts said.

In a court filing supporting the settlement, State Farm wrote it believes it could win at trial.

Plaintiffs’ lawyers, in their filing of support, cited the monetary payments to about 4.7 million members of the class action.

“After two decades of litigation, the members of the class action suit are gratified State Farm is finally paying the damages that are due,” Robert A. Clifford, lead counsel for plaintiffs in the case and senior partner of the Chicago-based Clifford Law Offices, said in a statement late Tuesday.

He added: “This settlement is a victory for the little guy against a national corporation with incredible power, influence and resources.”