Key congressional committees have clinched a last-minute deal to protect patients from receiving “surprise” medical bills, potentially putting an end to nearly two years of infighting over an issue that’s pitted powerful health care giants against each other and frustrated Congress.

Shielding insured patients from eye-popping medical bills for unexpected out-of-network and emergency care has been a bipartisan priority for lawmakers, but progress had been stalled for over a year. The late-breaking deal surprised Washington, where the fight over what was supposed to be a simple policy fix had devolved over the past two years into a lobbying blood bath – with private equity-backed physician groups pouring millions of dollars to sink an earlier deal that could cut into their profits.

In recent days, sources said House Speaker Nancy Pelosi ramped up pressure on House Ways and Means Chair Richard Neal (D-Mass.), who is aligned with physician groups and had been one of the largest impediments to striking a deal. The compromise reached Friday night hews closer to the policy preferred by doctors and physicians.

Pelosi in a Friday night statement said the measure should be included in a year-end funding package, while Senate Minority Leader Chuck Schumer said he hoped it would be “passed into law as soon as possible.” Representatives for Senate Majority Leader Mitch McConnell didn’t respond to a request for comment

What’s in the deal: The committees largely abandoned a framework struck earlier in Congress by the Senate HELP and House Energy and Commerce committees. That bicameral legislation would have set a benchmark rate health insurers would pay providers for out-of-network care, pegged to local charges for in-network rates. Health insurers favored the proposal, but doctors and hospitals fought hard against the idea, saying it was tantamount to price controls.

Instead, the latest proposal — which was formalized Friday night — calls for parties to negotiate an agreed-upon rate or bring their dispute to a mediator. Air ambulances, which can often leave patients with bills worth tens of thousands of dollars and had been a sticking point in negotiations, would also be included in the surprise billing ban.

Billing disputes could be batched together for a mediator, who would be allowed to take several factors into consideration: the median in-network rate for the service in question, the complexity of the case, and the relative market power of the insurer versus the doctor or hospital, among other factors. However, the mediator wouldn’t be allowed to account for the charges billed by a provider, which are typically far greater than the actual cost of care.

Importantly, larger bills for out-of-network care wouldn’t be outlawed entirely. Providers would still be allowed to bill patients to make up the difference of what insurers would otherwise pay if they inform patients the services won’t be covered and they provide an estimate of charges 72 hours before care.

Additionally, the deal includes long-term funding extensions for key health programs, like community health centers and diabetes research and prevention.

Why it matters: Stories of patients facing unexpected medical bills have flooded news reports in recent years, prompting Congress to take up the issue.

However, just earlier this week renewed talks appeared dead after Neal again rejected the bicameral framework. But Pelosi kept pushing for an agreement. Besides Neal’s Ways and Means panel, three other committees are involved in the latest talks: Senate HELP, House Energy and Commerce and House Education and Labor.

“Under this agreement, the days of patients receiving devastating surprise out-of-network medical bills will be over,” committee leaders said in a joint statement. “Patients should not be penalized with these outrageous bills simply because they were rushed to an out-of-network hospital or unknowingly treated by an out-of-network provider at an in-network facility.”

Should this deal fail, prospects for a fix in the next Congress would be uncertain. Two of the key Republican champions of a surprise billing fix — Alexander and Energy and Commerce ranking member Greg Walden of Oregon — are retiring this year.

Read more:

Get your custom MOON reading