Kansas City Southern (NYSE:KSU) backtracked over the weekend, saying it plans to accept a $27.2 billion cash and stock acquisition offer from Canadian Pacific (NYSE:CP) and walk away from a rival bid from Canadian National (NYSE:CNI).

It's the second time Kansas City Southern has changed its mind. The railroad initially agreed to let Canadian Pacific acquire it back in March, but it reversed course and accepted a $30 billion offer from Canadian National two months later.

The deal is not done yet, but there's good reason to believe this time around Canadian Pacific will be able to see its offer through to completion.

Two Kansas City Southern trains passing.

Image source: Kansas City Southern.

Regulators have their say

Investors knew from day one of this takeover saga that a big deal would be hard to get by regulators, and indeed it appears in the end it will be the U.S. Surface Transportation Board (STB) that ultimately determines Kansas City Southern's fate. Twenty years ago, the STB declared a moratorium on major railroad consolidation, effectively freezing the North American landscape at seven large railroads.

Kansas City Southern, as the smallest of the seven, always seemed the most likely to test the STB and do a deal. And Canadian Pacific, because of its relatively small size, seemed the likely suitor. Canadian Pacific earlier this year won STB approval to form a trust to acquire shares of Kansas City Southern while the regulator deliberated on the merger. While that's separate from winning regulatory approval to close the deal, it's a clear indication that approval is possible.

Canadian National, meanwhile, found the terrain much more difficult to navigate. It's a much larger railroad: By revenue it's larger than Canadian Pacific and Kansas City Southern combined. It also has a lot more overlap with Kansas City Southern, making a deal much more problematic by antitrust standards.

Although Kansas City Southern initially favored Canadian National's higher offer price, an STB decision late last month to deny Canadian National a voting trust similar to what it had approved for Canadian Pacific derailed the effort. The STB in its analysis decried a Canadian National/Kansas City Southern combination as creating "potential harms to the public interest."

A North American railroad

Canadian National probably knew going in that its bid was a long shot, but Kansas City Southern is arguably a prize worth the risk. A winning bidder would create a truly North American railroad, with track spanning from the Atlantic to the Pacific and from Canada down to a deepwater port in Mexico. The combined route map would offer shippers a nonstop option to transport goods from Asia to many large U.S. and Canadian markets.

Canadian Pacific map of the combined CP/KCS network, showing its continental reach.

Image source: Canadian Pacific.

Kansas City Southern has informed Canadian National of its intention to walk away, but under the terms of its agreement with Canadian National, the latter has the right to negotiate for five business days. Although it's possible Canadian National will attempt to sweeten its offer or come up with some other way to level the playing field against Canadian Pacific, with the STB's ruling looming in the background, it seems unlikely Kansas City Southern will backtrack once again and further extend this long period of investor uncertainty.

Assuming not, Canadian Pacific and Kansas City Southern will begin what could be a yearlong process to win final approval to merge. Kansas City Southern shareholders should receive their payout well before that process is complete thanks to the trust, meaning most of the risk will be on Canadian Pacific and its investors while the railroads navigate the approval process.

Canadian National can win by losing

Although it's hard to call Canadian National a winner here, the railroad isn't in bad shape. As noted, it's much larger than either of the other railroads involved and has a network that should be able to compete even if its largest rival is able to bulk up.

Given the substantial premium Canadian National was offering -- nearly 50% higher than Kansas City Southern's unaffected price a year ago -- and the substantial risk that comes with railroad integrations, Canadian National holders have a lot to be thankful for.

The best-case scenario for Canadian National is the status quo, which could still happen if the STB over the course of reviewing the Canadian Pacific merger offer sours on the deal. Conversely, if the deal goes well, it could make the STB more open to further consolidation, potentially opening a path for Canadian National to acquire a U.S. East Coast railroad such as CSX down the line.

But the most likely outcome is the exact one investors were expecting back in March, when Canadian Pacific first announced its plans and before Canadian National stepped in. 

After months traveling in circles, this railroad drama might be finally nearing the end of the line.

This article represents the opinion of the writer, who may disagree with the “official” recommendation position of a Motley Fool premium advisory service. We’re motley! Questioning an investing thesis -- even one of our own -- helps us all think critically about investing and make decisions that help us become smarter, happier, and richer.