On Thursday, the effort was declared over.
The attempt to recover bodies was called off, 26 days after a derailed train slammed into the town and erupted into a wall of flames.
The estimated death toll: 47. As they announced an end to their search, provincial police said only 42 bodies had been recovered while five people remained missing.
They said they did everything they could to find the bodies.
"We feel certainty today that everything that could have been done, was done," said provincial police Lt. Guy Lapointe.
"And not only that — (it was) done well."
It had been two weeks since a body was found.
On the day that last body was found the head of the Quebec provincial police's crime scene investigators, Steven Montambeault, cried during interviews as he described sights and smells that he said will haunt him forever.
The number of bodies found could still change, even if the search is over, Lapointe said. The coroner's office, meanwhile, said it has identified 38 of the bodies and will work to identify the rest.
A spokeswoman saluted residents of Lac-Megantic for being so helpful and understanding during the search, despite the painful circumstances.
"We conclude the work today with the deep and sincere conviction that we did everything that was humanly possible to find everyone who went missing," said Genevieve Guilbault, a spokeswoman for the coroner's office.
"On behalf of the coroner's office I would like to salute, one more time, the exemplary and admirable courage and the dignity of the people of Lac-Megantic."
The coroner's office had asked for DNA samples, through objects like toothbrushes, to help identify the bodies.
The frantic, immediate aftermath of the tragedy is now shifting to a new phase that will feature detailed investigations and lengthy legal battles.
Transport Canada raided the Farnham, Que., offices of the Montreal, Maine & Atlantic Railway on Thursday, looking for documents. The agency was accompanied by RCMP officers during its visit.
The provincial police force made a similar raid several days ago to gather material for its ongoing criminal investigation.
Meanwhile, the lawsuits are piling up.
A local lawyer announced Thursday that she was teaming up with Texas litigator Mitchell A. Toups to sue MMA and its partners in U.S. courts. Other lawsuits, class-actions, have already been planned.
The municipality of Lac-Megantic is also considering suing MMA to recoup $8 million in cleanup costs. It says it hasn't received a satisfactory response to its lawyer's letters. The railway says it doesn't have the money and is already hinting at potential bankruptcy as it awaits a financial lifeline from its insurers.
Aside from the forensics unit, another team of out-of-town visitors was also leaving Lac-Megantic on Thursday.
The Transportation Safety Board of Canada announced that it was wrapping up its on-site operations, after having finished gathering evidence at the site.
Now the TSB will analyze evidence it's collected. It will pore through photographs, 3D images, the train's black box, fluid samples and pieces of wreckage.
The safety board says it will take months, and perhaps more than a year, to complete the investigation.
Even with the probe in its infancy, the board has already recommended two changes to train regulations that have been adopted by the federal government.
The TSB will conduct numerous tests of the fluid inside the train's tanker cars to inspect the properties of the petroleum product, which set off several fireballs after the crash.
Donald Ross of the TSB says the liquid that was supposed to be in the rail cars is not considered flammable enough to create such large blasts.
"I think for most people that arrived on the site, they were quite surprised at the extent of the fire and the subsequent explosions that occurred," Ross said.
"We want to make sure that the dangerous goods that were involved here, that they were properly described, that they were properly packaged in the right tank cars — and we're going to check into all those things."
Fellow TSB investigator Ed Belkaloul added that the crude oil reacted in an "abnormal" way.
The agency said the laboratory phase will also include the analysis of metallurgical samples, damage records and photographs to determine the viability of the tanker cars involved in the July 6 crash.
Also on HuffPost