OTTAWA -- MPs have passed back-to-work legislation to end the Canada Post strike, after a late night of debate in the House of Commons and a staged walkout by New Democrats.

Bill C-89, the “Postal Services Resumption and Continuation Act," passed by a vote of 166 to 43 early Saturday morning. It now goes before the Senate, which is sitting this weekend.

If the bill receives royal assent, Canada Post workers will be forced back on the job at noon the following day.

Even before MPs had begun debating the bill on Friday, they butted heads over a motion to fast-track C-89. All but a handful of NDP MPs staged a walkout during a vote on the motion. One by one the New Democrats nodded at the Speaker and walked out, some with fists raised towards the public viewing galleries.

The move came after the NDP pledged their solidarity with the striking postal workers, some of whom had spent the day occupying ministers’ offices.

After the walkout, six New Democrats remained in the House because that was the maximum number of third-party MPs who would be permitted to speak to the bill under the parameters of the motion, according to the NDP.

The fast-track motion passed 173-13, allowing the House to move through multiple legislative steps in rapid succession by limiting the length of debate and letting Labour Minister Patty Hadju determine when debate would end.

As she kicked off debate on the bill itself, Hajdu was met with chants of “Shame! Shame!” from the public viewing galleries where postal workers had convened. As they continued to disrupt the proceedings, Parliament Hill security escorted the demonstrators out, with at least one leaving in handcuffs and the union vowing this would only be the beginning of a bitter battle.

“They’re attacking democracy and the rights of workers,” NDP Leader Jagmeet Singh said in the House foyer after the walkout, saying the Liberals had completely undermined the workers’ ability to negotiate a fair deal.

Bill C-89 spells out the process for the postal workers to return to the job "without delay" while continuing negotiations with a new, independent mediator-arbitrator.

The governing Liberals took the step to legislate Canada Post back to work on Thursday, a day after a special mediator was re-appointed to help try to find a compromise following months of unsuccessful contract negotiations and rolling strikes that have led to a backlog of mail deliveries.

Hajdu said at the time that it was not a step she took lightly and still was hopeful the two sides would strike a deal before legislation would be imposed, but on Friday she was decisive that this strike needed to end, calling postal service “essential.” She spoke of the reliance Canadians and businesses have on timely postal services, especially during the holiday season.

Both Crown Corporation Canada Post and the Canadian Union of Postal Workers (CUPW) remained at the bargaining table throughout Friday, with no sign of a deal to be had.

As the parliamentary scene unfolded on the Hill, out on the lawn Canada Post employees had gathered with signs, even a large crafted head of Prime Minister Justin Trudeau. “Here to legislate injuries and unpaid work just like Harper,” read one. “Manufactured crisis,” read another.

All day, mail service was halted in the nation’s capital and in other places across the country, as rotating strikes continued.

The postal workers union has restated its vow to take the government to court over the bill, should it pass.

"The fact that the government would not only violate constitutional rights, but then impose undemocratic means of getting it through so there’s no real debate allowed on this bill," CUPW President Mike Palacek said in an interview with CTV News earlier Thursday.

The Canadian Press has reported that two independent senators, Frances Lankin and Diane Griffin, wrote Hajdu expressing their concern that the bill may not be constitutional.

In response to this, immediately after the vote on the motion passed, Justice Minister Jody Wilson Raybould stood in the House and tabled a Charter statement on the legislation, outlining her department’s argument for why the bill is compliant with the Constitution.

The last time back-to-work legislation was used for Canada Post workers was in 2011 by the then-Conservative government. It was challenged in court and found five years later to be unconstitutional, though Hajdu defends this new bill as taking a different, more "fair and balanced" approach.