SIOUX FALLS, S.D. (AP) — South Dakota could end up owing hundreds of thousands of dollars in legal fees to the private attorneys who fought the state’s ban on gay marriage unless a federal appeals court sides with the attorney general.

Minneapolis attorney Josh Newville, who has represented the six same-sex couples challenging the ban for more than a year, hasn’t charged his clients and now plans to seek attorney’s fees from the state.

READ MORE: Police: 15-Year-Old Carjacking Suspect Arrested In St. Paul

Before he can do that, the 8th Circuit Court of Appeals must affirm U.S. District Judge Karen Schreier’s ruling in January that declared the ban was unconstitutional as well as rule in favor of Newville and the couples.

Attorney General Marty Jackley filed a motion Monday seeking to vacate Schreier’s decision and dismiss the case, arguing the judge erred in her original ruling and that there’s nothing more to argue following last week’s decision from the U.S. Supreme Court.

Under federal law, plaintiffs in federal civil rights cases can petition a court to award them legal fees if a court finds in their favor, which Newville hopes the 8th Circuit will do.

Newville said he thinks Jackley is asking for the case to be dismissed so that the state isn’t on the hook for any potential legal fees, which he estimates could be hundreds of thousands of dollars, and so South Dakota isn’t “on the wrong side of history.”

READ MORE: 1 Killed In Acton Township Shooting

“This is an effort to dodge the liability for the attorney’s fees for all of the attorneys that fought hard on behalf of these plaintiffs over the last year,” he said.

Newville said about 95 percent of the fees are likely owed to him, but said he has worked with other local attorneys in the state, too.

The high court’s ruling, which cites a 2006 opinion from the 8th Circuit Court of Appeals, proves that Schreier incorrectly sided with the plaintiffs, Jackley said Thursday. He said Schreier erred in ruling that same-sex marriage bans were unconstitutional when the previous 8th Circuit ruling allowed for such bans and that it is grounds to throw out her decision.

He said he’s pursuing to dismiss the case because it “shows that South Dakota had been following the rule of law in our state,” but also said he doesn’t think South Dakota should be responsible for any fees.

“We’ve all along followed the rule of law, and therefore should not be required or responsible for plaintiff’s attorney’s fees,” he said.

MORE NEWS: Heat From Fire Caused Loaded Gun To Discharge, Injuring Wisconsin Firefighter

(© Copyright 2015 The Associated Press. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.)