CALGARY - Canadian Pacific Railway Ltd. says it will acquire the Central Quebec and Maine Railway, which operates the tracks at the centre of the Lac-Megantic disaster in 2013.

CP Rail and Fortress Transportation and Infrastructure Investors LLC, a New York investment firm, say they have entered into a definitive agreement for the nearly 800 kilometres of track that stretches to ports in Maine and Saint John, N.B. The price of the deal wasn't disclosed.

The rail line encompasses the tracks that saw a runaway train hauling tanker cars loaded with volatile crude oil break loose on July 6, 2013, and barrel into Lac-Megantic, where it derailed and exploded into a massive ball of fire that consumed much of the downtown core and killed 47 people.

The line remains under scrutiny, with Transport Canada recently flagging more than 250 defects on the tracks. In September, a group of Lac-Megantic residents sought an injunction to block the shipment of dangerous goods in the area pending repairs, while a coalition of municipalities has called on the federal and provincial governments to take further steps toward track safety.

Transport Canada says the railroad operator has notified it that the problems have been fixed. Nonetheless, the Transportation Safety Board of Canada announced a derailment last weekend in Bolton West, Que. It said no there were no injuries or dangerous goods released.

CP Rail says the deal is expected to close at the end of 2019 and remains subject to customary closing conditions.

A subsidiary of Fortress Investment Group LLC bought the bankrupt Montreal Maine and Atlantic Railway for US$17 million in 2014.