The Senate late Wednesday approved legislation to address Puerto Rico’s growing debt crisis, stepping in to help the ailing territory just ahead of a daunting deadline.

By a vote of 68-30, senators cleared a bill that would let the island restructure its massive debt load, while establishing an outside control board to police its troubled finances.

ADVERTISEMENT

The bill now heads to President Obama, who has been a vocal proponent of the measure and is expected to sign it in short order.

The measure will become law just in time, as Puerto Rico is facing a default on $2 billion of debt payments Friday. The default would be the largest yet for the troubled island, and was expected to unleash a torrent of messy litigation without congressional action.

The Senate-passed bill would halt any potential litigation between the island and creditors, and allow outside officials to step in and try to steer towards a more organized resolution.

The bill’s passage marks a rare achievement for the White House and the leadership from both parties in both chambers. The top Republicans and Democrats in both the House and Senate threw their support behind the measure, and urged their colleagues to back the measure.

While the measure had cleared a key procedural hurdle earlier Wednesday when the Senate agreed to limit debate on the package, some Democratic opponents were threatening to drag consideration of the bill into Thursday.

But under a deal that allowed a pair of procedural votes on amendments, the Senate was able to clear the measure Wednesday, wrapping up work for the week a day early.

The bill’s passage draws to a close a contentious and complicated fight over a tricky policy issue that lawmakers typically avoid in an election year. But years of economic decline and fiscal mismanagement left Puerto Rico in a position where it was slashing public services and not paying back creditors, compelling Congress to address the issue.

The lobbying battle over the bill was intense, as investors in Puerto Rican debt descended on Washington to make their case, or try and prevent any bill from passing in the first place.

Lawmakers had to push back against a raft of ads, believed to be sponsored by a group of investors, blasting the bill as a “bailout.” No new federal dollars go to Puerto Rico as part of the legislation.

The Treasury Department hammered out the bill after weeks of talks with House Republicans, and the House passed the bill with bipartisan majorities earlier this month.

Groups on both the right and left were unhappy with the legislation — both Heritage Action and a coalition of major labor unions opposed the bill.

Conservatives argued the bill did not do enough to relax regulations on the island, arguing it would boost its ailing economy, and expressed concern about reworking existing contracts with creditors.

Meanwhile, Democrats balked at establishing a powerful new board of outside experts to steer the island’s finances. But lawmakers from both parties banded together to send the bill to the president, billing it as the only good option to aid Puerto Rico.