A Quebec Superior Court judge has granted creditor protection to the Canadian subsidiary of Montreal, Maine & Atlantic Ltd., the railway at the centre of last month's deadly train derailment in Lac-Megantic, Que.

The ruling, which was handed down Thursday morning, follows an application made Wednesday by MMA and its Canadian subsidiary for bankruptcy protection.

Justice Martin Castonguay said he hopes the decision will limit the potential "judicial anarchy" of multiple creditors all seeking compensation from the railway.

He noted that the behaviour of MMA has been "lamentable" since the rail disaster, which killed 47 people and destroyed much of the town's downtown core on July 6.

"The court is not at all impressed with the conduct of MMA since the start," he said shortly after making his decision.

Montreal, Maine & Atlantic Canada Co. filed documents seeking relief from its creditors under the Companies' Creditors Arrangement Act.

Under the CCAA, companies are granted protection while they work to avoid bankruptcy.

Castonguay said another judge will preside over future hearings on the matter, with the next hearing scheduled for Aug. 23 in Lac-Megantic.

He noted that the residents of the town have "a right to know what's going on," and shouldn't have to make the roughly 250-kilometre drive west to Montreal to attend the hearing.

Montreal lawyer Ian Rudnikoff told CTV's Canada AM that the company's decision to file for bankruptcy protection does not mean that the company is off the hook, but that the affected residents of Lac-Megantic will now be added to the same list of all the creditors seeking compensation from the company.

"They're in the same position as every other creditor," he said Thursday, speaking from Montreal.

Rudnikoff said eventually an offer will be made to all the company's creditors, but warned that the amount will likely be less than what's owed.

"Ultimately an offer will be made to all of the classes, or all of the creditors, where each of the creditors who have a valid claim will receive their pro-rated share of what's available," he said. "But to say that they will receive 100 cents on the dollar is highly unlikely."

Rudnikoff said there is a certain pecking order in terms of which class of creditors will receive compensation first and the amount of compensation given.

Among the different creditors who will likely seek compensation from MMA will be trade creditors, employees, those Lac-Megantic residents who lost a loved one and those who suffered property damage, he said.

MMA chairman Ed Burkhardt said in a statement Wednesday that the company remains committed to working with the province and the municipality to help rebuild the community.

The cost of cleaning up Lac-Megantic is estimated to be around $200 million.

The railway said in court documents that the Canadian branch has just under $18 million in assets and around $25 million in insurance coverage, which it has yet to receive from its insurer.

Court documents, which were posted to the Bangor Daily News website, said the company's U.S. parent firm has between $50 million and $100 million in estimated assets and between $1 million and $10 million in estimated liabilities.

To date the town says it has spent $8 million toward the cleanup and recovery. The federal government has pledged $60 million to the town.

A number of class-action lawsuits are being planned against the company and the town has said it's considering suing MMA to recoup the $8 million spent so far.

Forty-two bodies have been recovered from the disaster zone, while five others were never found.

With files from The Canadian Press