LAC-MEGANTIC, Quebec — A driverless, runaway fuel train that exploded in a deadly ball of flames in the center of a small Quebec town started rumbling down an empty track just minutes after a fire crew had extinguished a blaze in one of its parked locomotives, an eyewitness said on Monday.

The train rolled 8 miles from the town of Nantes to the town of Lac-Megantic, near the Maine border in eastern Quebec, gathering speed on a downhill grade. It derailed in the middle of Lac-Megantic early Saturday and blew up, flattening dozens of buildings and killing five people. Another 40 are missing and feared dead.

The Nantes fire service told Reuters it had put out an engine fire in one of the locomotives late Friday.

Andre Gendron, 38, lives on a wooded property next to the railyard in Nantes. He said he was burning a campfire outside his trailer on Friday night when he heard the firetrucks.

“About five minutes after the firemen left, I felt the vibration of a train moving down the track. I then saw the train move by without its lights on,” Gendron told Reuters.

“I found it strange its lights weren’t on and thought it was an electrical problem on board. It wasn’t long after that I heard the explosion. I could see the light from the fires in Lac Megantic.”

The center of Lac-Megantic, a lakeside town of 6,000, still was cordoned off on Monday morning as police struggled to find the remains of people who likely died.

Police said they had been unable to examine much of the town center overnight because the area was still too dangerous. Dozens of rail tanker wagons, some of them destroyed, were sprawled around the accident site.

“It’s an area that is still extremely risky … The fire service decided they could not allow us to go there for security reasons. We’ll see what we can do today,” police spokesman Benoit Richard told reporters on Monday.

Nantes Fire Chief Patrick Lambert said his crew had switched off the locomotive late on Friday as they extinguished a “good-sized” blaze in the motor, probably caused by a fuel or oil line break in the engine.

“We shut down the engine before fighting the fire,” he told Reuters in an interview. “Our protocol calls for us to shut down an engine because it is the only way to stop the fuel from circulating into the fire.”

The tanker train’s operator, the Montreal, Maine & Atlantic Railway, said the engineer had parked the train in Nantes on Friday night and left one locomotive running to ensure the air brakes worked properly.

The company’s chairman said the brakes will not work if a train is switched off.

“If the operating locomotive is shut down, there’s nothing left to keep the brakes charged up, and the brake pressure will drop finally to the point where they can’t be held in place any longer,” Ed Burkhardt told the Toronto Star.

Canadian crash investigators said they will look at two sets of brakes on the train, the air brakes and the hand brakes, as they probe what could turn into Canada’s deadliest rail accident since 1956.

Lambert said once the blaze was out, the Nantes fire service contacted Montreal, Maine & Atlantic Railway.

“We told them what we did and how we did it,” Lambert said.

Asked whether there had been any discussion about the brakes, he replied: “There was no discussion of the brakes at that time. We were there for the train fire. As for the inspection of the train after the fact, that was up to them.”

Montreal Maine & Atlantic is one of many North American railroads that have vastly stepped up shipments of crude oil as pipelines from North Dakota and from oil-producing regions in western Canada fill to capacity, and the accident is bound to raise concern about the practice of transporting oil by rail.

The company was not immediately available to comment.

One of the destroyed buildings in Lac-Megantic was a music bar popular with young people. Witnesses reported fleeing the outside of the building as the heat and flames closed in.

Some of those feared dead may have been in the bar in the early hours Saturday.