The Supreme Court of Canada ruling on Thursday ended a seven-year legal battle by Joel Ifergan, an accountant, to claim his share of the prize.

Ifergan went to a local convenience store just before 9 p.m. on May 23, 2008, to purchase tickets for that night's "Lotto Super 7" drawing. The store clerk told him to hurry before the 9 p.m. deadline, according to a court summary.

While the clock on the lottery terminal read 8:59 p.m., only one of the two tickets was registered in time. The second ticket, the winning one, was printed and registered on the Loto-Quebec computer at seven seconds after 9 p.m., eligible for the following week's drawing.

The store clerk told Ifergan that only one ticket was registered in time and asked if he still wanted to buy the second ticket. Ifergan said he did, and paid for both.

After he was denied half of the lottery jackpot, which was awarded to another winner, Ifergan sued Loto-Quebec for the processing lag.

The case has been working its way through Canada's courts. The Supreme Court did not comment on the case.