Canadian Pacific Railway has given up its attempt to merge with Norfolk Southern Corp., days after the U.S. Justice and Defense departments raised concerns about the proposed takeover of the Virginia-based company.

Calgary-based Canadian Pacific initially proposed the deal in November, which would have created the largest railway in North America. It would have cost about US$30 billion and expanded CP's rail network, especially in the eastern U.S. and the Chicago area where there is a major rail hub.

But Canadian Pacific said Monday that it is no longer going to ask Norfolk Southern shareholders during their annual meeting on May 12 to vote in favour of merger negotiations.

"We have long recognized that consolidation is necessary for the North American rail industry to meet the demands of a growing economy, but with no clear path to a friendly merger at this time, we will turn all of our focus and energy to serving our customers and creating long-term value for CP shareholders," CEO Hunter Harrison said in a statement.

Canadian Pacific's (TSX:CP) move comes after the U.S. Justice Department expressed opposition to the company's proposal to set up a voting trust pending a regulatory review of the merger.

The department said the voting trust proposal would compromise Norfolk Southern's independence and effectively combine the two railways before the review by the U.S. Surface Transportation Board was complete.

The U.S. Defense Department also weighed in, saying a full review by the Surface Transportation Board was required because the potential exists that a merger could "adversely affect national defence," according to a letter it wrote to the board dated last Thursday. It pointed out that both rail companies serve major military bases that need rail service to perform their missions.

The Defense Department said it was also troubled that under the voting trust proposal, Harrison could become a senior executive at Norfolk Southern prior to the regulator ruling on the proposed merger, and therefore may be put in a position to make business decisions with potentially competing interests.

Analyst John Larkin of Stifel Nicolaus said Canadian Pacific will likely have to bank on the election of a supportive Republican president this fall to make another run at creating a transcontinental railway. But Larkin said securing U.S. military approval could be a bigger challenge.

"But Hunter is energetic and would like a transcontinental railroad, in which he believes so passionately, to be the crowning achievement of a stellar railroad career," Larkin said in an email.

Norfolk Southern (NYSE:NSC) had objected to the proposal on various grounds including what it considered an inadequate offer price and resistance from its customers and U.S. regulators. In a news release Monday, the railway thanked shareholders and employees for their support as it works to improve its operations.

Canadian Pacific runs railways in Canada and parts of the U.S. Midwest and South, while Norfolk Southern of Norfolk, Va., operates railways along the U.S. East Coast, Midwest and South.

On the Toronto Stock Exchange, Canadian Pacific shares closed up 2.6 per cent to $179.91 in Monday trading, while Norfolk's shares were down 2.7 per cent to US$79.28 on the New York Stock Exchange.