Kansas City Southern (KSU) has terminated its deal to be acquired by Canadian Pacific Railway (CP 0.21%), instead accepting a $33 billion bid from Canadian National Railway (CNI 1.30%).

Kansas City Southern (KCS) and Canadian Pacific (CP) struck a deal back in April, but Canadian National (CN) countered with a rival offer that KCS' board has deemed superior. On Thursday, Canadian Pacific said it would not sweeten its bid, setting the stage for KCS and CN to formalize a deal.

As part of the termination and new agreement, Kansas City Southern paid a $700 million breakup fee to CP, which will be reimbursed by Canadian National.

"We are thrilled that KCS has agreed to combine with CN to create the premier railway for the 21st century," Canadian National CEO JJ Ruest said in a statement. "I would like to thank the numerous stakeholders of both companies who have demonstrated overwhelming support for this compelling combination, and we look forward to delivering the many benefits of this pro-competitive transaction to them."

A Canadian National train cuts through a mountain pass.

Image source: Canadian National.

But the battle is far from over. Canadian National now has to win regulatory support for the deal, and that is not a formality.

The U.S. Surface Transportation Board (STB), which 20 years ago declared a moratorium on major railroad consolidation, has said the CN/KCS deal would be weighed not just on whether it would have a negative impact on competition -- the railroads must also show the combination would have a positive impact.

Some powerful voices are skeptical. The Department of Justice has signaled its opposition to the CN/KCS deal, and British investment firm TCI Fund Management, a major holder of both CP and CN shares, has called on Canadian National to abandon its bid because it does not believe its offer can win approval.

Canadian National is running into more regulatory opposition because it is much larger than the other two railroads involved. In fact, a combined Canadian Pacific/KCS would still be smaller than Canadian National in terms of revenue.

Canadian National's first step is to try to win regulatory approval for a voting trust that would acquire Kansas City Southern prior to the two sides winning regulatory approval for the deal, a step that would minimize the regulatory risk for KCS shareholders. CP had a similar arrangement approved, but the STB rejected CN's initial application.

Canadian Pacific remains defiant, saying in a letter to the STB released Friday that it intends to move forward with its application to acquire Kansas City Southern based on its belief the CN deal will ultimately be rejected.