OTTAWA -- The federal government apologized Friday to Omar Khadr, sparking fresh public debate about the former Guantanamo Bay inmate and a new round of political finger-pointing in a long-running drama that has left Canadians deeply divided.

After the apology to the Toronto-born Khadr was released on paper, Public Safety Minister Ralph Goodale emerged to confirm the two sides had reached a settlement -- and to acknowledge that it would not please everyone.

"The debate will no doubt continue passionately on all sides," Goodale told a news conference on Parliament Hill. "It is a complex saga."

Khadr wound up in U.S. custody at Guantanamo at age 15 for allegedly throwing a grenade that killed American soldier Christopher Speer in Afghanistan in 2002. He pleaded guilty to five war crimes -- including killing Speer -- before a military commission, a process that has since been widely condemned.

The Supreme Court ruled in 2010 that the Canadian government's participation in the "then-illegal military regime" at Guantanamo breached Khadr's guarantee of fundamental justice under the Charter of Rights and Freedoms.

Khadr, now 30, says his captors repeatedly threatened him with rape, isolated him and on one occasion used him as a human mop to wipe up urine.

Records show they deprived Khadr of sleep by moving him from cell to cell, a practice known as the "frequent flyer program" designed to break down resistance to interrogation.

In February and September 2003, officials from the Canadian Security Intelligence Service and Foreign Affairs questioned Khadr at Guantanamo and shared the results of their interrogations with the Americans.

A Foreign Affairs official interviewed him again in March 2004, knowing he had been subjected to the "frequent flyer" treatment. This time, Khadr refused to answer questions.

The Supreme Court said the interrogations offended "the most basic Canadian standards" about the treatment of young detainees.

Khadr was transferred to a Canadian prison in 2012.

The federal apology, delivered Friday in a terse statement, did not mention financial compensation, but followed reports of a controversial $10.5-million settlement of Khadr's long-standing lawsuit.

"On behalf of the government of Canada, we wish to apologize to Mr. Khadr for any role Canadian officials may have played in relation to his ordeal abroad and any resulting harm," the statement reads.

"We hope that this expression, and the negotiated settlement reached with the government, will assist him in his efforts to begin a new and hopeful chapter in his life with his fellow Canadians.

"The details of the settlement are confidential between Mr. Khadr and the government."

My full statement on the Canadian Government's decision regarding Omar Khadr: https://t.co/jwo6J7JEoE pic.twitter.com/92O0PJO24D — Stephen Harper (@stephenharper) July 7, 2017

Word this week that the government was planning to pay Khadr and issue an apology sparked anger among many Canadians who consider him an unrepentant terrorist who is now profiting from his crimes, at the expense of taxpayers.

Goodale and Justice Minister Jody Wilson-Raybould repeatedly drove home the point that regardless of the truth of what happened on the Afghan battlefield, the settlement dealt exclusively with the fact Khadr's charter rights were violated.

"Reaching a settlement was the only sensible course," said Goodale. "In the pursuit of justice and national security, governments must respect human rights and charter rights and the rule of law."

Goodale also laid the blame for the settlement squarely at the feet of Stephen Harper's former Conservative government, which refused to repatriate Khadr or otherwise resolve the matter, notwithstanding the Supreme Court ruling.

"They could have," he said, "but they didn't."

Court proceedings with respect to Khadr had already cost taxpayers close to $5 million in legal expenses, and not settling the case would have left them on the hook for millions more, Goodale said.

Added Wilson-Raybould: "A Canadian citizen's charter rights were violated; as a result, the government of Canada was required to provide a remedy."

Conservative Leader Andrew Scheer called the settlement "disgusting," saying Khadr's return to Canada should have been remedy enough.

"Justin Trudeau should never have agreed to a secret deal that gave a convicted terrorist millions of dollars," he said Friday. "As prime minister, I would have fought against this payout in court."

NDP justice critic Alistair MacGregor took precisely the opposite position, and blamed both the Liberals and the Tories in equal measure.

"Successive Liberal and Conservative governments failed to uphold Omar Khadr's rights under Canadian law and instead were complicit in the violation of Mr. Khadr's constitutional rights," he said.

Speaking on condition of anonymity, a source familiar with the situation told The Canadian Press that the government wanted to make the financial payment to Khadr promptly to get ahead of a massive U.S. court award against him.

"The money has been paid," the source said.

Two years ago, Speer's widow Tabitha and Layne Morris, another U.S. soldier who was injured in the battle, won a US$134.1-million default judgment against Khadr in court in Utah.

Cameron Ahmad, a spokesman for the prime minister, denied the timing of the settlement had anything to do with U.S. proceedings.

Supporters have also long pointed to the fact that Khadr was just 15 when he committed the acts he confessed to -- and therefore he should have been treated as a child soldier in need of protection, not prosecution.

In a statement issued shortly after the apology was released, Khadr's lawyer, Dennis Edney, savaged the way his client was treated by the Harper government.

"Omar Khadr was abandoned in a hellish place called Guantanamo Bay, for 10 years, a place internationally condemned as a torture chamber," said Edney.

Officials in the Conservative government, he continued, "chose not to face the truth, preferring to trade in bigotry and divisiveness."

Goodale said the government informed Trump administration officials of the settlement before it was announced.

-- With additional reporting from Colin Perkel in Toronto