The Canadian government will apologize and give millions to a former Guantanamo Bay prisoner who pleaded guilty to killing a U.S. soldier in Afghanistan when he was 15, an official said Tuesday.

An official familiar with the matter told the Associated Press that Omar Khadr will receive $8 million. The deal was negotiated with Khadr’s lawyers and the Canadian government last month.

Khadr was 15 when he was captured by U.S. troops following a firefight at a suspected Al Qaeda compound in Afghanistan that resulted in the death of U.S. Special Forces medic, U.S. Army Sgt. First Class Christopher Speer. Khadr, who was suspected of throwing the grenade that killed Speer, was taken to Guantanamo and ultimately charged with war crimes by a military commission.

The Canadian-born Khadr pleaded guilty in 2010 to charges that included murder and was sentences to eight years plus the time he had already spent in custody. He returned to Canada two years later to serve the remainder of his sentence and was released in May 2015 pending an appeal of his guilty plea, which he said was made under duress.

The Canadian Supreme Court ruled in 2010 that Canadian intelligence obtained evidence from Khadr under “oppressive circumstances,” such as sleep deprivation, during interrogations at Guantanamo Bay in 2003, and then shared that evidence with U.S officials.

His lawyers filed a $20 million wrongful imprisonment lawsuit against the Canadian government, arguing the government violated international law by not protecting its own citizen and conspired with the U.S. in its abuse of Khadr.

The widow of Speer and another American soldier blinded by the grenade in Afghanistan filed a wrongful death and injury lawsuit against Khadr in 2014 fearing Khadr might get his hands on money from his $20 million wrongful imprisonment lawsuit. A U.S. judge granted $134.2 million in damages in 2015, but the plaintiffs acknowledged then that there was little chance they would collect any of the money from Khadr because he lives in Canada.

Khadr's lawyers have long said he was pushed into war by his father, Ahmed Said Khadr, whose family stayed with Usama bin Laden briefly when Omar Khadr was a boy. Khadr's Egyptian-born father was killed in 2003 when a Pakistani military helicopter shelled the house where he was staying with senior Al Qaeda operatives.

After his 2015 release from prison in Alberta, Omar Khadr apologized to the families of the victims. He said he rejects violent jihad and wants a fresh start to finish his education and work in health care. He currently resides in an apartment in Edmonton, Alberta.

The Associated Press contributed to this report.