David Bundy for The New York Times

Jefferson County, Ala., took a big step toward resolving its historic bankruptcy case on Tuesday, saying it had reached an agreement to refinance most of the debt at the heart of its financial breakdown.

The refinancing would save the county hundreds of millions of dollars and position it to emerge from bankruptcy in a matter of months, according to people briefed on the negotiations. But the terms must still be approved by a federal bankruptcy judge, and the county must clear several other hurdles before it can emerge from bankruptcy. Lawyers for the county are scheduled to present details of the agreement in federal bankruptcy court in Birmingham on Wednesday.

The deal, according to the people briefed on the negotiations, covers about $2.4 billion of Jefferson County’s total $3.078 billion in sewer debt, which was issued to pay for significant repairs needed to bring the county into compliance with federal clean water laws.

The interest due on the sewer debt shot up during the financial turmoil of 2008, and the repayment schedules accelerated sharply, leaving the county unable to pay. The repairs went unfinished as well.

The county also had other debt outstanding when it declared bankruptcy, for a total of $4.2 billion, making it the biggest municipal bankruptcy in United States history.

Governmental bankruptcies are rare and usually involve small single-purpose authorities and districts, not large, complicated counties with a lot of debt. Experts in public finance have been watching Jefferson County closely to see what kind of legal precedent it will set. Some were concerned that the successful application of Chapter 9 bankruptcy rules to municipal debt could cast a pall over the municipal bond market.

Residents of the county, for their part, have worried that they would bear the brunt of the bankruptcy, through lower property values or higher taxes or rates paid for county services.

The refinancing agreement covers debt held by creditors that include JPMorgan Chase, which holds about $1.22 billion of the sewer debt, the biggest block; three bond insurers; and seven hedge funds, according to a term sheet circulated in a meeting of the county commission on Tuesday.

The terms call for these creditors to receive about $1.84 billion for the $2.4 billion of debt they now hold. The concessions were weighted most heavily toward JPMorgan, the term sheet said, “to increase the recovery of other sewer creditors.”

The bank is giving up $842 million, or about 70 percent, of the face value of its debt, according to people briefed on the negotiations. Just before declaring bankruptcy in 2011, the county abruptly rejected a previous package of concessions that called for JPMorgan to give up about $750 million.

JPMorgan was widely expected to make big concessions as part of any bankruptcy settlement, because some former officials of the bank were found to have been involved in improprieties in connection with a county debt refinancing in 2002 and 2003. That refinancing involved a complex package of variable-rate bonds and derivatives called interest-rate swaps.

A lawsuit by the county against JPMorgan over the improprieties, still active in state court, would be resolved as part of the proposed agreement. In 2009, JPMorgan agreed to forgive all the termination fees the county owed on the swaps, or about $647 million, to settle a complaint from the Securities and Exchange Commission. The bank also paid the county $75 million under the same settlement.

Despite those concessions, residents of Jefferson County have still often complained that they were treated inequitably because several of their elected officials went to prison as a result of the refinancing, while no one from the bank was convicted of a crime. They have railed in particular against the possibility that their sewer rates would go up to allow the county to pay sewer debt that many now see as illegitimate.

On Wednesday, the federal bankruptcy judge, Thomas B. Bennett, is also scheduled to hear arguments in a lawsuit arguing that much of the debt was issued in violation of the state Constitution and should be voided, not restructured or repaid.

In addition, the Bank of New York Mellon, as trustee for small creditors, has asked Judge Bennett for a full independent review of the sewer system’s finances, as well as what it has called “poor planning, gross incompetence, waste, graft, corruption or fraud in connection with the construction, repair or rehabilitation” of the sewer system since 1997.

The term sheet indicated that the sewer fees for county residents would indeed rise, by 7.41 percent a year for the first four years of the refinancing deal. After that, they could rise by as much as 3.49 percent a year, depending on variables like inflation and new federal clean-water regulations.

Still, members of the county commission said the new agreement was significantly better than what they could have won without the bankruptcy filing. The five-member commission approved the terms in a 4-to-1 vote.

If the refinancing goes forward, the county’s public creditors on the sewer debt will be offered a choice: either 80 cents for every dollar of sewer debt they now hold, if they relinquish all other claims, or 65 cents on the dollar with the right to pursue their own claims, either against the county or its bond insurers.