A company operating near Fort McMurray has been hit with the largest penalty in Alberta for a workplace safety violation.

Sinopec Shanghai Engineering Company Canada will have to pay out a total of $1.5 million.

"I expect the court is right in its belief that a penalty like this will deter," said Crown prosecutor Marshall Hopkins outside of the St. Albert court house Thursday.

The company pleaded guilty to three charges of failing to ensure the health and safety of workers.

The charges stem from an accident that happened almost five years ago that killed two temporary foreign workers and injured two others.

The workers from China died in 2007 near Fort McMurray when a storage tank collapsed at Canadian Natural Resources Ltd.'s Horizon project.

A judge ruled Thursday the company will pay a fine of $200,000, with the rest of the money — $1.3 million-  going to a new program teaching temporary foreign workers about their rights when it comes to safety on the job.

"We're hoping to do good things with the creative sentencing," said Kevin Flaherty, with Alberta Workers Health Centre which will run the program. "It enables us to do some good work with a bad situation."

In a written statement the company said it "sincerely regrets the deaths" and fully supports the proposal to use the fine to fund the program which should be up and running later this year.

With files from CBC's Lydia Neufeld