Canada’s federal government has moved swiftly to end an industrial dispute that just brought two of the country’s largest railways to a halt, threatening supply chains across North America.

Labour Minister Steve McKinnon said railways operations should resume “within days” as he sent both sides to final binding arbitration.

Canadian National Railway (CN) and Canadian Pacific Kansas City (CPKC) locked out nearly 9,300 workers on Thursday, after failing to clinch a deal with the Teamsters union.

Canada sends around 75% of all the goods it exports to the US, mostly by rail. A prolonged dispute could have disrupted shipments of a range of goods, from grains and beans to potash, coal and timber.

“Workers, farmers, commuters and businesses rely on Canada’s railways everyday, and will continue to do so,” Mr McKinnon said. “It is the government’s duty and responsibility to ensure industrial peace in this critically vital sector.”

Canada, the world’s second-largest country by area, relies heavily on rail transport.

The government said that while it supports the collective bargaining process, it needed to exercise its powers under Canada’s Labour Code in order to ensure important goods and trade were still being transported.

Under its orders, the Canada Industrial Relations Board will settle the disputes over the collective agreements. In the interim, the Board will also extend the current terms of the collective agreements, so that workers can resume work as soon as possible.

Labour agreements for both railways expired at the end of last year.

After months of talks, the increasingly bitter negotiations ground to a halt late on Wednesday evening, CBC reported, with both sides accusing the other of refusing to negotiate seriously.

CN and CPKC had both been calling for binding arbitration.

CN said on Thursday it was “satisfied” that the labour dispute would be mediated.

“The Company is disappointed that a negotiated deal could not be achieved at the bargaining table despite its best efforts,” it added.

Keith Creel, chief executive of CPKC, said the government had acted “to protect Canada’s national interest”.

“We regret that the government had to intervene because we fundamentally believe in and respect collective bargaining; however, given the stakes for all involved, this situation required action,” his statement added.

Speaking to the BBC on Thursday, before the arbitration was announced, the National President of Teamsters Canada, François Laporte, said the sticking point for his union was safety.

“Across Canada, we have trains who are carrying goods, they are carrying energy, they are carrying chemicals,” he said. “And we want to make sure that those trains are operated by people who get the proper rest, who are safe, who are not fatigued.”