Oil producers and refineries are in the midst of a transition to shipping their oil by rail, and that means the Keystone XL pipeline is not needed, a report from Canaccord Genuity Inc. says.

Phil Skolnick, head of North American energy research with Canaccord Genuity, says the market currently sees Keystone XL as a necessity, but he believes investors will soon come to see oil by rail as a more flexible and economically advantageous solution.

“The plans are there in place and … rail is becoming more efficient. There is huge trade between Canada and the U.S. in oil and the economics of rail are more compelling than pipe,” he said in an interview with CBC News.

This will happen despite fallout from the Lac-Mégantic rail disaster, in which a train pulling tanker cars with oil from the Bakken formation in North Dakota to a New Brunswick refinery, exploded in a small Quebec town, killing 47 people and destroying the town.

“The thing is that with light rail cars, you shouldn’t have that kind of explosive shipment,” Skolnick said. “ What happened there is a matter of practices that are put in place that would improve safety.”

Both the Canadian Transportation Safety Board and U.S. regulators are looking into the conditions that led to the Lac-Mégantic tragedy and are likely to recommend railways adopt new practices that will boost safety.

Keystone XL is being promoted in Washington by Prime Minister Stephen Harper as a means to get heavy oil taken from the Alberta oilsands to refineries on the Gulf Coast. However, President Barack Obama has yet to approve the project, which faces opposition from environmentalists and communities along the pipeline route.

Just yesterday, Canadian rocker Neil Young waded into the heated debate over the oilsands and Keystone XL in a speech that compared Fort McMurray to Hiroshima.

"The fact is, Fort McMurray looks like Hiroshima,” Young said at the National Farmers Union conference in Washington. "Fort McMurray is a wasteland. The Indians up there and the native peoples are dying. The fuel’s all over — the fumes everywhere — you can smell it when you get to town."

He said native people are dying of cancer because oilsands development poisons their water. He urged the United States not to approve Keystone, as it would accelerate oilsands development.

While Canadian oil producers wait for a decision on Keystone, oil by rail is getting more efficient and the transportation bottlenecks to get oil to market by rail are being eliminated, Skolnick said.

Among the factors that will make oil by rail more cost-effective:

A backlog in building rail tanker cars from earlier this year is now being cleared and should accelerate through 2014.

The Canadian rail business is moving from a manifest system, in which trains might have to make four to five stops, to a unit system, in which trains go directly from point A to point B.

Oil by rail is more flexible, as it permits oil to go to the East and West Coasts of the U.S., as well as the Gulf.

Oil by rail is faster than pipeline, getting heavy oil to the refinery in 15-20 days, rather than close to 50 days via pipeline.

“There are very good market dynamics when you have rail,” Skolnick said. "The producers know this and they are behind rail, I think."

Skolnick also said developments in refining crude oil will favour rail.

Refineries on the Gulf Coast designed for heavy oil have excess capacity due to the decline in Mexican and Venezuelan production. They are currently refining light crude, but could easily move back to heavy oil as Canadian oil from oilsands becomes available.

BP's Whiting Refinery Northwest Indiana is expanding, creating an opportunity to refine oil from the Bakken shale and from Canada which would be accessible to oil by rail.

Skolnick believes resolving the bottleneck issues for transporting and refining crude will help Western Canadian Select oil move closer to global oil prices. That means a big improvement in return potential for producers.

As a result, Canaccord has a buy recommendation on oilsands producer MEG Energy and is reiterating its buy recommendations on Canadian oil-related companies such as Baytex Energy, Cenovus, Devon Energy and Twin Butte Energy. Skolnick holds positions in all of these stocks.