A federal court judge found Canadian Pacific Kansas City Limited in contempt of court in connection with cases of excessive hours worked for certain employees.

Over a ten-month period in 2018 and 2019, the rail operator failed in 22 cases to comply with cease and desist orders issued by an arbitrator, the ruling said.

The orders related to rest provisions under federal regulations and collective agreements for conductors and engineers that largely limit shifts to 10 or 12 hours, depending on the circumstances.

“CP’s own evidence was that ‘thousands of situations continue to occur each year where employees are not off duty within 10 hours,'” Judge Ann Marie McDonald wrote, citing the labor arbitrator.

The railroad did not argue that the situations were exceptions set out in the collective agreement, the arbitrator said in March 2018.

Teamsters Canada President Francois Laporte said the company “needs to get its act together and stop putting profits before people before another tragedy happens.”

“Canadian Pacific is putting lives at risk by forcing so many train crews to work longer hours than expected,” Laporte said in a statement Wednesday.

The Calgary-based company said it was disappointed with the decision.

“We respectfully disagree with the court’s decision and will appeal,” spokesperson Patrick Waldron said by email.

The June 6 ruling comes less than two months after a Canadian Pacific freight train ran off the tracks in Maine, with several cars and locomotives catching fire.

The track is the same as the one where the Lac-Mégantic tragedy took place in 2013. Canadian Pacific did not own the track at the time.