Ohio has agreed to pay $1.3 million in legal fees stemming from the case that toppled bans on gay marriage in all 50 states.

According to The Columbus Dispatch, U.S. District Judge Timothy Black has approved the agreement between the Ohio Department of Health and Cincinnati law firm Gerhardstein and Branch Co., which represented Jim Obergefell in his challenge to Ohio's restrictive marriage ban.

Black sided with Obergefell but his ruling was overturned by the Sixth Circuit Court of Appeals in Cincinnati. Attorneys appealed to the Supreme Court, which found in June that gay couples have a constitutional right to marry.

Black on Monday issued his final order based on the high court's ruling.

Attorney General Mike DeWine, whose office defended the ban in court, has not commented on the settlement.