(Bloomberg) -- President Joe Biden vetoed a bill designed to kill the administration’s sweeping student-debt relief plan on Wednesday.

The legislation, initiated by congressional Republicans, would have thwarted the president’s executive action to cancel billions of dollars in student debt and eliminate the government’s restructured repayment program. 

The bill passed with support from a small contingent of Democrats earlier this month, undermining support for the policy within the president’s own party.

Two moderate Democratic senators, Joe Manchin of West Virgina and Jon Tester of Montana, casted votes in favor of the measure as did Senator Kyrsten Sinema, a once-Democrat-turned independent.

The passage of the bill in the Democratic-controlled Senate delivered a blow to the president who made student-debt cancellation a key presidential campaign promise. The reality highlights mixed attitudes regarding Biden’s plan to forgive as much as $20,000 in federal student loans for eligible borrowers. 

The program is broadly popular with progressives, young voters and people of color. 

Two Democratic lawmakers in the House — Representatives Jared Golden of Maine and Marie Gluesenkamp Perez of Washington State — also broke from a coalition united against the legislation by voting in favor.

Biden did not address the Democrats who supported the bill in a video address announcing the veto. “I’m going to keep fighting to make sure college is cheaper, make student-loan systems more manageable for borrowers,” he said.

The measure still faces obstacles that cannot be overcome by the stroke of a pen. Proponents of the plan have more to worry about in the US Supreme Court, where justices expressed skepticism of its merits during oral arguments in February. Some legal experts predict the court’s conservative majority will strike down the plan.

Justices are expected to issue an opinion on the legality of the program before late June. The executive action has been caught in legal battles since its release last August. 

“I’m never going to apologize for helping working- and middle-class Americans as they recover from this pandemic. Never,” Biden added in the video, a reference to the administration’s legal argument, which relies on a 2003 law giving the Education Department broad authority to manage federal-student loans in a national emergency.

©2023 Bloomberg L.P.