Days before they were due back at college, two friends on a midnight stroll across a train trestle in Ellicott City died in a freak accident in which a passing freight train derailed, dumping thousands tons of coal down from the raised tracks.

The deaths of Elizabeth Nass and Rose Mayr, both 19, on Tuesday a few minutes after midnight provided investigators with more questions than answers.

Why were they on a single-track rail bridge at the bottom of the town’s quaint Main Street? Didn’t they hear the approaching 90-car train that stretched for more than half a mile behind two locomotives? Were they struck by the train? Did they die under the avalanche of coal as more than 20 cars toppled on their side?

“These accidents happen very quickly,” said Jim Southworth, lead investigator for the National Transportation Safety Board. “They don’t take much time at all, but the investigations take a great deal of time.”

Some of the mystery will be resolved by available evidence. Southworth will review video from a camera mounted on the lead engine and will interview the three-member train crew.

In statements taken by police, the crew members said they never saw the two women as the train passed by.

On-board data recorders — similar to the devices on commercial airplanes — will provide information that will reveal the sequence of events and could point to a cause. An NTSB track expert was summoned from Chicago to examine the rail bed for abnormalities.

Why the two women skirted the town’s old flagstone railroad station for a walk on the tracks at midnight may be an impossible question to answer.

“I’ve never seen anyone on the bridge in the three years I’ve lived here,” said Lauren Ward, 23, who lives 75 yards up Main Street in a third-floor walk-up above LaLa’s ice cream parlor. “Apparently they were drinking. There are seven bars within walking distance.”

Just before they died, Nass posted to Twitter: “Drinking on top of the Ellicott City sign with [Rose].”

The rail line that links the coal fields of West Virginia to Baltimore is expected to be closed for days. The business of cleaning up thousands of tons of coal, righting the toppled train cars and restoring service is complicated by two factors. The single track means there is no adjacent track that could serve as a platform for rail cranes that could upright the cars.

In addition, more than a dozen phone, electric and cable lines that run along tall poles are at right angles over the crash site, causing a dicey problem for the use of helicopters from above or large cranes from below.

Ellicott City train derailment (Gene Thorp/The Washington Post)

As investigators began to figure out what went wrong, this much was known:

As midnight neared on narrow Main Street in the historic section of Ellicott City, a Monday night atmosphere had invoked its relative quiet on the block lined with shops that sell antiques, ice cream and tourist-oriented knickknacks. The restaurants were closed; a few of the bars remained open.

From the west, the long train that had been loaded with coal in Grafton, W.Va., rumbled toward town at about 25 mph, pulled by CSX Engine 267 in the lead coupled to CSX Engine 4579 and a long trail of gray coal cars.

Getting to the bridge above Main Street, which is smack against the gray stone of Acquisition Home and Design, requires a walk up the hill that is Maryland Avenue. Just beyond the old railroad station that is now a B&O railroad museum, and around a bright red caboose that is a fenced-in museum exhibit, a pedestrian can step onto the tracks.

The bridge is about 100 yards down the rails, and there is a comfortably wide walkway on the bridge apron for crossing. A seat on that walkway would give a view of Main Street. Sitting on the other side provides a view of the Patapsco River.

From atop the bridge, the women tweeted two photos, one looking up Main Street and the other showing their feet dangling as they sat on the bridge.

Apparently they settled in on the river-view side, perhaps because a 19th-century iron fence on the Main Street side kept them from sitting on the edge. In bold gold letters painted on that side of the bridge are the words “Ellicott City.”

At 11:40 p.m., Nass sent a tweet that was read by her brother, Brendan: “Drinking on top of the Ellicott City sign with [Rose].”

It is unclear whether the two women got up too late when they heard the train. But as the engines chugged over the bridge, past the station and near a sharp curve to the left, a brake line that connects each car to the next severed, and an automatic system began slamming on the brakes on each of the cars.

The cars began to derail to the left, spilling their coal. Some came to rest on their side, others tumbled from the bridge or down the embankments on either side.

“I heard the train coming,” said Ward, who was in her bed up Main Street. “It was a really loud screeching, and my dresser was shaking. Then I heard sirens.”

The exchange of tweets ended abruptly; a few minutes later, there was news of a train wreck, said a family member who did not want to be identified. Brendan and his younger brother, Jonathan, rushed to the scene of the wreck to look for their sister.

Both families responded Tuesday to knocks on the door, saying they would prefer not to talk about Nass and Mayr. Nass was about to return to James Madison University. Mayr was about to go back to the University of Delaware.

Boris Gamazaychikov heard from a friend a few minutes after the derailment who told him that Nass and Mayr were tweeting about drinking atop the Ellicott City sign. When he learned of the accident and two deaths, he went over to the scene.

He said he dated Mayr for two years, that they recorded a song together and posted it to YouTube, and that they remained friends after the romance ended. They went camping on Sunday and then watched the TV series “Breaking Bad,” Gamazaychikov said.

“I feel like I’m losing part of myself,” he said Tuesday, his voice breaking. “She’s the kind of person you don’t get to meet very often.”

Maggie Fazeli Fard, Malu Banuelos, Michael Ruane, Ovetta Wiggins and T.J. Ortenzi contributed to this report.