Five people have died and 40 are reported missing in Canada after a train carrying crude oil derailed causing explosions that destroyed dozens of buildings in a town in Quebec.

The tanker train, which had been parked, rolled down a hill without a driver gathering speed before it went off the tracks.

The train with 72 cars and five locomotives hurtled into Lac-Mégantic, a lakeside town of about 6,000.

The operator of the train has said that the air brakes used to hold the locomotive in place may have been released after the train was parked.

The statement from Montreal, Maine & Atlantic Railway did not make clear how the brakes had been disengaged, or who could be responsible.

Montreal, Maine & Atlantic Railway, a small operator with 500 miles of tracks in New England and eastern Canada, had said an engineer had correctly secured the train for the night.

Montreal Maine & Atlantic said it had not been able to complete its own investigation while the Canadian government was probing the cause of the blast.

Crude oil shipments by rail have become increasingly popular in North America as pipelines fill to capacity and more and more oil is produced in western regions like Alberta and North Dakota.

But accidents on this scale are rare.

Four of the cars - which each carried 30,000 gallons of North Dakotan crude oil - caught fire and blew up in a fireball that mushroomed many hundreds of feet into the air.

It destroyed dozens of buildings, many of them totally flattened, included shops, a library and the popular Musi-Cafe music bar, eyewitnesses said.

The town centre was crowded with weekend partygoers at the time.

Chief Lapointe said it was hard to calculate the number of possible victims because the area was still too dangerous for police to examine properly.

Some people had been reported missing more than once, and some were nowhere near the town.

The blast ruptured a water main, creating a shortage of drinking water, forcing the town to bring in special tankers.

The centre of town remained blocked off, but from the air, it was clear that many buildings had been reduced to little more than piles of bricks and wood.

Residents' photos showed the burnt out hulks of cars next to smashed houses.

After the blast, burning crude spilled into the storm sewers and rose up through street manholes, setting buildings on fire, the head of the rail company that ran the train told Reuters.

Edward Burkhardt, chairman of Montreal, Maine & Atlantic Railway, said an engineer had parked the train some distance from the town a few hours before the disaster.

"He claims he set the brakes on all five of the engines. He also claims he set the brakes on a sufficient number of cars on the train," he told Reuters in an interview.

Officials said they had few reports of injured victims, suggesting that people caught up in the blast either died on the spot or managed to escape.

The rail tracks pass next to the Musi-Cafe, which is popular with young people.

Police imposed a 1km security zone around the blast and evacuated a total of about 2,000 people from their homes.

The Canadian Transportation Safety Board, which investigates all accidents, said it was looking for the train's "black box" data recorder.

Lac-Mégantic is part of Quebec's Eastern Townships region, an area popular with tourists that borders both Maine and Vermont. Quebec is a predominantly French-speaking province in the eastern half of Canada.

There have been a number of high-profile derailments of trains carrying petroleum products in Canada recently, including one in Calgary, Alberta, last week when a flood-damaged bridge sagged toward the still-swollen Bow River.

The derailed rail cars were removed without spilling their cargo.