WASHINGTON — Less than an hour before the government was set to shutdown, the Senate passed a spending bill to fund the government through April, 63-36. President Obama signed the bill shortly thereafter.

The vote came after West Virginia Sen. Joe Manchin backed off his push to extend coal miners insurance for a year as part of a bill to fund the government, averting the risk of a shutdown at midnight Friday.

In a speech on the Senate floor Friday evening, Manchin expressed grave disappointment that Congress would only extend health care benefits for retired miners and their widows for four months, rather than the longer extension he had pushed for. While Manchin will not hold up the government funding bill past Friday night's deadline, he said that he would vote against the bill in protest.

Manchin chastised his colleagues for using working Americans and coal miners in their campaign ads, while refusing to negotiate on extending benefits for them and instead going home for the holidays.

“Every one of us have done those ads. Every one of us. Our 435 House members who had to go home yesterday because it was time for Christmas. … We have basically missed 100 working days this year, you think we’ve been overworked?" Manchin said on the Senate floor. "But I guess my House members did, they had to go home. They wouldn’t even give us the courtesy of a three-day extension."

With a shutdown looming Friday at midnight, Manchin and Ohio Democratic Sen. Sherrod Brown — both of whom are up for re-election in 2018 in coal country states that Trump won — kept urging GOP leadership to renegotiate an extension for expiring benefits for miners and their widows within the end-of-year funding bill. The bill currently extends the program for four months.

A senior Senate Democratic aide said Friday that Democrats, including Manchin, Brown and others, had actually agreed during a lunch on Thursday not to shutdown the government. The plan, instead, was to "use the threat of a shutdown to bring renewed attention to the miners, and set up a push for a longer extension and solution in January."

"The bottom line is we now have the viability to make something happen," Manchin said in a press conference Friday evening.

"So if nothing else, first of all we’ve been able to elevate what coal miners have done for this country, the respect that they should be receiving…next of all being able to truly have a long-term fix."

Asked if his public fight for coal miners this week will help with his re-election, Manchin responded: "I sure don’t think it hurts."

"If I’m not going to stand up for them, who is?"

Brown, who didn't join Manchin for the press conference, spoke on the floor Friday evening about why he would be voting no on the continuing resolution.

“This is just too important to back down,” Brown said, calling the uncertainty the miners would have to deal with “cruel and unusual punishment.”

The Senate is expected to vote on the spending package later Friday night, before the midnight deadline. While Manchin, Brown and others pledged to oppose the legislation, New York Sen. Chuck Schumer said on the Senate floor that supporters will have sufficient votes to keep the government open and allow Congress to leave Washington for the rest of the year. "We're going to provide the votes to make sure we don't shut down," he said.

Manchin, who could be up for a job in President-elect Donald Trump's administration, even canceled a meeting in New York with Trump on Friday to continue his push.

But Republicans did not budge on changing the existing bill, however they committed to continue working on the issue.

Republicans argued that language in the bill itself, which funds the government through April 28, cannot be changed unless members of the House return to Washington, D.C., and agree to the new version of the legislation. The House voted overwhelmingly, 326-96, to pass the spending legislation before leaving town for the year on Thursday.

Sen. Shelley Moore Capito, Manchin's Republican colleague from West Virginia, said Friday that while a four-month extension for coal miners was not ideal, senators should take the deal they have on the table and avoid a shutdown. "I think there is a strategy of four months, while it's meager and frustrating and disappointing, does give us the opportunity to live to fight another day. Because if the whole thing goes down, they're going to lose everything starting January 1," she said.

Manchin said that he was heartened by Majority Leader Mitch McConnell's commitment to pushing for a longer extension next year, before benefits run out again in April. "I believe him, I do," Manchin said, thanking McConnell for his pledge. But, he noted that he has not yet gotten such assurances from Republican leaders in the House.