Senate Republicans, after a flurry of last-minute deals, salvaged their tax plan early Saturday and put Congress on track to deliver President Trump’s most significant first-year accomplishment.

The ambitious package, opposed by Democrats as a giveaway to the wealthy that will pile on the national debt, challenges GOP orthodoxy against deficit spending. Even after accounting for future economic growth, the plan is estimated to add $1 trillion to the deficit over 10 years, despite Republican promises that the tax cuts will pay for themselves.

Still, all but one Republican voted to approve the bill. Sen. Bob Corker of Tennessee, one of the GOP’s few remaining deficit hawks, joined all Democrats in opposing the plan in a 51-49 vote. The bill must now be reconciled with a House-passed version, a process that leaders hope to complete as early as next week.

Corker, who is retiring at the end of his term, voted no after he was unable to convince colleagues to install a mechanism to claw back some tax breaks in the future if they worsened the deficit.

“I am disappointed,” Corker said. “I wanted to get to yes. But at the end of the day, I am not able to cast aside my fiscal concerns and vote for legislation that I believe, based on the information I currently have, could deepen the debt burden on future generations.”

As recently as Friday morning, passage was uncertain after a tumultuous week that exposed deep fissures among Republicans. Complicating matters for Corker and others was a congressional report that doubted GOP assumptions that tax cuts would generate enough economic growth to cover their costs.

Republicans could lose just two votes from their 52-seat Senate majority to pass the bill, amid Democratic opposition. That gave almost every GOP senator an opening to push for a deal.

Sen. Susan Collins (R-Maine), who at times negotiated directly with Trump, secured changes to tilt benefits back toward middle-income households, particularly the reinstatement of a deduction for property taxes — important to California and other areas with high-cost real estate. That deduction had been eliminated as part of a broader repeal of state and local tax deductions for individuals in the original Senate plan.

The property tax deduction will be capped at $10,000, as proposed in the House bill, making reconciliation between the chambers potentially easier, especially because the provision was important to House Republicans from New York, California and other high-tax states.

“You’ll see more middle-class relief from that,” said Sen. Rob Portman (R-Ohio), who helped broker the deal with Collins.

The final Senate bill also includes a repeal of the Affordable Care Act requirement that Americans have health insurance, which the Congressional Budget Office estimated would result in higher premiums and leave an additional 13 million Americans without coverage.

Collins, who worried about that outcome, said she also won assurances from GOP leaders that they would help pass bipartisan bills designed to stabilize Obamacare markets and assist low-income consumers, and to protect the Medicare program from possible budget cuts that might arise from the tax plan.

In another last-minute change, Republicans dropped plans to repeal the so-called alternative minimum tax for individuals, which would help raise hundreds of billions of dollar to pay retaining the property tax deduction and tax cuts elsewhere.

Eliminating the AMT had been a key component of the GOP’s framework, agreed to by congressional Republican leaders and the White House, part of their goal to simplify the tax code. Now Republicans will have to merge the Senate approach with the House bill, which proposed killing the AMT, reducing federal revenue by nearly $700 billion over a decade.

As the debate dragged Friday, behind the scenes other senators were negotiating agreements, and one by one announced their support.

Another key GOP holdout, Sen. Jeff Flake (R-Ariz.), agreed to support the plan after winning a commitment from the White House and GOP leadership that there would be a forthcoming immigration deal to allow young immigrants, known as Dreamers, to permanently remain in the U.S. without threat of deportation if Trump ends the so-called DACA program as planned next year.

Flake spoke personally to Vice President Mike Pence on Friday morning to ensure a seat at the table for an immigration deal.

Sen. Ron Johnson (R-Wis.), who had been working to secure bigger tax breaks for businesses and wealthy professionals that organize as pass-through entities, said he received assurances from leaders that some of what he wanted would be included in the final bill.

One change Johnson secured would increase a proposed 17.4% deduction of income for those entities to 23%, which will be paid for with an increase in the repatriation tax rate for foreign earnings from the original 10% to 14%, also putting the Senate bill in line with the House version.

An earlier deal with Sen. Lisa Murkowski of Alaska opened part of the Arctic National Wildlife Refuge to oil and gas drilling.

It is likely that the Senate and House versions will be swiftly reconciled in a conference committee, though it is also possible that the House may opt to simply approve what the Senate passed.

Unlike the collapse of GOP efforts to repeal Obamacare, Republicans in Congress appear determined to stick together and not let their differences interfere with their goal of passing tax cuts by year-end.

Republicans are hungry for a legislative accomplishment with control of Congress and the White House, especially before they face 2018 midterm voters and deep-pocketed donors, who have grown impatient with other stumbles, particularly on healthcare.

Groups backed by the wealthy Koch brothers, in particular, have been a constant presence at the Capitol, pushing the tax bill forward.

The rushed process, conducted largely behind closed doors, drew criticism from Democrats and others for foregoing the usual hearings and debate expected for such a major legislative undertaking.

“This is not the way to do business in the U.S. Senate,” said Sen. Jeff Merkley (D-Ore.) during the floor debate. “This is the way to do business in the swamp.”

After receiving the revised text hours before the vote, Democrats started tweeting pictures and videos of the inches-thick bill, complaining about the scribbled changes in the margins.

Democrats criticized one revision from Sen. Pat Toomey (R-Pa.) that would have specifically exempted Hillsdale College in Michigan from a new 1.4% excise tax on university endowment investment income. Among the school’s graduates is Blackwater founder Erik Prince, the brother of Trump’s Education Secretary Betsy DeVos, and other alumni now in the Trump administration.

The change was quickly revised to exclude Hillsdale from special treatment. But the provision was struck from the final bill by an amendment sponsored by Democrats.

By midnight, Pence arrived at the Capitol to cast the tie-breaking vote on an amendment from Sen. Ted Cruz (R-Texas) and championed by social conservatives to expand tax-deferred 529 college savings accounts to K-12 private school tuition and home-school expenses. The House bill goes a step further expanding the accounts for unborn children.

Overall, the House and Senate bills would be the most massive rewrite of the tax code in a generation, centered on the reduction of the 35% corporate rate to 20%, its lowest level since the Great Depression.

The bills lower individual rates — the Senate drops the top 39.6% rate to 38.5%, the House lowers it to 35%, other differences that will need to be resolved.

But both bills also do away with many popular deductions used by Americans to reduce their tax bills, including the personal exemption.

Instead, the bills offer an enhanced standard deduction, at $24,000 for couples, and a more generous $2,000 child tax credit in the Senate version.

While taxpayers across income levels are expected to see cuts on average at first, the benefits are uneven and some households, nearly 1 in 10, would see a tax hike, according to the Tax Policy Center.

Nonpartisan analyses show tax benefits flow mainly to the wealthy with reductions of $34,000 a year for the top 1% while lower-income households see $50 tax breaks.

And while the corporate cuts are permanent, the individual rates — under the Senate version — expire in 2025, meaning most middle-income taxpayers would face tax hikes in eight years.

The late decision to maintain the AMT will particularly hit middle- and upper-income households that have become increasingly exposed to the tax, which was initially designed to tax the wealthiest filers.

One of those taxpayers was Trump. According to a leaked portion of this 2005 federal tax return, Trump paid $31.2 million in alternative minimum tax. That accounted for the bulk of the $36.6 million he paid in federal income taxes that year.

For years, Republicans railed against rising deficits under then-President Obama. But the report Thursday from the nonpartisan congressional Joint Committee on Taxation said only about $408 billion would be raised through growth created by the tax cuts, leaving a $1-trillion shortfall.

Corker, the powerful chairman of the Foreign Relations Committee, had pushed for a trigger mechanism to reverse some tax cuts if deficits rise, but it was not allowed under Senate rules.

Once leaders secured votes from other holdouts Friday, they appeared ready to push forward with the vote, with or without him.

UPDATES:

10:50 p.m.: This article was updated after the final Senate vote.

LATimes | Lisa Mascaro and Jim Puzzanghera – Contact Reporters

ALSO

Bannon’s ouster could boost the powerful Koch network, which has surprising sway in Trump’s White House

McCain’s surprise vote doomed GOP healthcare bill, but did it open the door for Senate bipartisanship?

Is this small-town congressman from New Mexico tough enough to win Democrats the House majority?