CALGARY -- A deal has been worked out in a class-action lawsuit filed over an E. coli outbreak and the largest meat recall in Canadian history.

The lawsuit is against XL Foods Inc., which operated a meat-packing plant in southern Alberta during a tainted beef recall in 2012.

"We've reached an agreement on the class action subject to court approval," Calgary lawyer Clint Docken, who is representing a handful of clients, said Thursday.

Compensation has been set at $4 million, said Docken, and a hearing is to be held this fall to formally approve the deal.

XL Foods recalled more than 1.8 million kilograms of beef in Canada and the United States in 2012.

The plant in Brooks, Alta., was sold to JBS Canada in 2013.

In October 2012, Brian Nilsson, one of the chief executives of XL Foods, apologized to people who became ill and was quoted in the media as saying that the company took full responsibility.

"It was hard fought definitely, but in terms of the process I think the matter has moved along. We've had a very proactive case management judge and that has been helpful," said Docken.

The settlement has a number of components, the lawyer explained. There is to be compensation for provincial health providers to cover their costs in dealing with injuries associated with the tainted meat. There is also money available for consumers who were forced to throw away meat after the extensive recall.

But the majority of the settlement is to go to those who became ill after eating the meat.

"People who suffered injury, particularly E. coli poisoning, as a result of consuming the meat are also potentially subject to a settlement as well," Docken said.

"There were some that suffered very serious illnesses and ended up with extensive hospitalization."

Docken said the actual number of claimants won't be known until the fall, but he noted that the majority are in Alberta and Ontario. Some in the United States.

Payments could range from hundreds to tens of thousands of dollars, he said.