The Canadian prime minister defended the government's apology and multimillion-dollar payment to a former Guantanamo Bay prisoner who pleaded guilty to killing a U.S. soldier in Afghanistan.

Justin Trudeau on July 8 said the deal was not about the merits of the case against Canadian-born Omar Khadr but the “charter of rights and freedoms” that protects all Canadians, “even when it is uncomfortable.”

The deal with Khadr was based on a 2010 Canadian Supreme Court ruling that the country’s officials violated his rights at the U.S. base on Cuba.

A person familiar with the payment said it was for 10.5 million Canadian dollars ($8 million), although details were not officially released.

Khadr was 15 when he was captured by U.S. troops following a battle in which a U.S. soldier was killed at an Al-Qaida compound in Afghanistan.

Khadr, who was suspected of throwing a grenade that killed the soldier, was taken to Guantanamo and charged with war crimes. He pleaded guilty in 2010 and was sentenced to eight years.

He was returned to Canada and was released in 2015 pending an appeal of his guilty plea, which he claims was made under duress.

The Supreme Court ruled that Canadian intelligence officials obtained evidence from Khadr under "oppressive circumstances," including sleep deprivation, during interrogations at Guantanamo and then shared the evidence with U.S officials.

Many Canadians reacted angrily to the government apology and payout to Khadr, saying he is a terrorist.

Based on reporting by AP and Reuters