A railway bypass will be built around Lac-Megantic, Prime Minister Justin Trudeau and Premier Philippe Couillard announced Friday, nearly five years after an explosion destroyed the town's core.

The two levels of government confirmed they have signed an agreement-in-principle to build the projected line.

Ottawa will cover 60 per cent of the cost of the $133 million project, while Quebec will pay for the rest.

“Today we are taking an important step to help heal the wounds of a community that has been through so much,” said Trudeau.

Couillard called it an exceptional response to an exceptional situation, while Trudeau expressed his sympathies for those still coping with the loss of loved ones.

"No community should have to live through what Lac-Megantic went through. No one should have to suffer the tragic loss of their own," he said.

"There's nothing we wouldn't give to go back in the past and avoid being here today to make this announcement," Trudeau said. "Obviously, we can't rewrite history, but we can, together, shape the future."

Former Lac-Megantic mayor Colette Roy Laroche was on hand for the announcement.

“It's news that comforts us,” she said. “It allows us to look toward the future and to live each day with more serenity.”

The 12.8 km route would run around the town of Lac-Megantic, whereas the existing route goes close to the lake. Most of the town was built near the railway line.

“In this particular case two levels of government are going to fund this bypass route because of the exceptional tragedy that occurred. It's not the normal rule,” explained federal Transport minister Marc Garneau.

The exact route is still being studied and the final cost is still being calculated.

"There are private lands all around this place and there is no question that there are going to be people impacted when you move a rail line. We have worked with consultation with the region, the municipality, with individuals to try to find the right path but any path is going to have consequences on some individuals. Any other path would have consequences on other individuals and land owners," said Trudeau.

While the announcement is welcome news for many, but there is opposition to the project. Property owners who will be affected by the construction of the rail bypass are angry about the government's decision.

Both the prime minister and the premier said they understand emotions are still raw but something had to be done.

“As soon as you move it somewhere, there are going to be people affected. This is why there's going to be another short period of consultation,” said Couillard.

While there may be minor changes, the project will move forward, they said.

On July 6, 2013 a runaway train carrying crude oil crashed in the downtown core of Lac-Megantic, causing an explosion and fire that killed 47 people.

The now-defunct Montreal, Maine and Atlantic Railway was fined $1,000,000, and five people were fined $50,000.

Three former employees were found not guilty on criminal charges, but six people pleaded guilty to federal charges of not ensuring enough hand brakes had been applied.

Lac-Megantic