TORONTO — Canada’s two largest railroads will roll their trains again after the government intervened to end a shutdown that arose from a labor dispute.After Canadian National and CPKC failed to reach new agreements with the Teamsters Canada Rail Conference union by an overnight deadline early Thursday, both freight railroads locked out nearly 10,000 of their workers — halting all rail traffic in Canada and shipments into the U.S. But, less than a day into the impasse, the Canadian government ordered both freight railroads to enter binding arbitration on Thursday. Once finalized, that means trains will get rolling again. Here’s what to know.It comes down to a labor-contract dispute and government intervention.Canadian National and CPKC railroads both locked out their employees after a 12:01 a.m. EDT deadline to resolve a dispute with Teamsters Canada Rail Conference passed without agreements. As a result, all of their trains in Canada stopped moving and shipments crossing into the U.S. were halted. That posed the protentional of significant economic harm to business and consumers across both countries, which rely on billions of dollars of goods running on rails each month.Talks resumed later in the day Thursday — as workers picketed outside. Meanwhile, business groups urged the government to force the arbitration. Prime Minister Justin Trudeau initially declined to force the parties into binding arbitration, for fear of offending unions and the leftist NDP party that his Liberal government relies on for support to remain in power. But the government’s approach changed by late afternoon when Labour Minister Steven MacKinnon announced the decision to order arbitration. MacKinnon said the government wanted to give negotiations every chance to succeed, but ultimately the economic risk was too great to allow the lockouts to continue. He had declined to order arbitration a week ago.“Canada’s economy cannot wait for an agreement that has been delayed for a very long time and when there is a fundamental disagreement between the parties,” he said.Both railroads had previously said they would end the lockout if the unions agreed to binding arbitration. But Paul Boucher, president of the Teamsters Canada Rail Conference, told union members Thursday morning that he believed the railroads were “holding the Canadian economy hostage to try and pressure the Liberal government to impose final binding arbitration and take your rights away to free collective bargaining.”The railroads have said that once the dispute enters arbitration the trains will be able to get moving again. But it wasn’t immediately clear how quickly the union’s 10,000 engineers, conductors and dispatchers will return to work.MacKinnon said he expects the trains will be running within days.Most previous Canadian rail stoppages have only lasted a day or two and usually involved only one of the big railroads, but some have stretched as long as eight or nine days. The impact was magnified this time because both railroads had stopped.Billions of dollars of goods move between Canada and the U.S. via rail each month. And while the end of the lockouts may be near, some consumers and businesses were already impacted Thursday.More than 30,000 commuters in Vancouver, Toronto and Montreal were the first to feel the pain of the lockouts. They had to scramble Thursday morning to find ways to get to work because their commuter trains aren’t operating while CPKC is shut down.Most businesses probably have enough supplies on hand and room to store finished products to withstand a brief disruption. But ports and other railroads would have quickly become clogged with stranded shipments that Canadian National and CPKC won’t pick up. Chemical businesses and food distributors would have been the first to be affected. The railroads stopped accepting new shipments of hazardous materials and perishable goods as they began gradually shutting down last week, in anticipation of Thursday’s full stop, but most chemical plants had said they would be OK for about a week.The auto industry was also bracing for potential spot shortages. That’s because General Motors, Stellantis, Ford, Honda and Toyota either assemble whole vehicles in Canada or ship engines and other components across the border. About 80% of vehicles put together in Canada are shipped to the U.S., largely by rail. Michael Robinet, executive director at S&P Global Mobility, explained that most auto assembly plants operate on “just-in-time” inventories of parts — making it difficult to stockpile for more than a couple of weeks.___Funk reported from Omaha, Nebraska. Associated Press writers Wyatte Grantham-Philips in New York and Tom Krisher in Detroit contributed.