The federal government has formally apologized to former Guantanamo Bay prisoner Omar Khadr, confirming Friday a financial settlement has been reached to end ongoing legal action.

"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," Public Safety Minister Ralph Goodale and Foreign Affairs Minister Chrystia Freeland said in a joint statement released to reporters Friday.

"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 statement said.

The government has already issued a $10.5-million cheque to the man who has been branded a terrorist by some, and a child soldier subjected to torture by others. Khadr received the money Wednesday, sources told CBC News.

Canadian-born Khadr, 30, had sued the federal government for $20 million for breaching his civil rights.

I hope Canadians take away two things today: Our rights are not subject to the whims of the government of the day, and there are serious costs when the government violates the rights of its citizens - Justice Minister Jody Wilson-Raybould

Goodale, speaking to reporters in Ottawa Friday along with Justice Minister Jody Wilson-Raybould, acknowledged Canadians hold "deeply divided" views about Khadr and his "complex saga," but said the settlement is necessary because of clear violations of Khadr's Charter rights by Canadian officials.

"It is not about previous behaviour on the battlefield in Afghanistan; it is about the acts and other decisions the Canadian government took against Mr. Khadr after he was captured and detained. Those facts are not in dispute and there is no doubt about how the Supreme Court views them. The government of Canada offended the most basic standards," Goodale said.

Public Safety Minister Ralph Goodale explains why Ottawa settled with Omar Khadr 1:50

'A proper conclusion'

"There is no doubt wrongs were done, and there's no doubt that we are bringing this process to a proper conclusion."

Goodale said Khadr's court proceedings have already cost the government some $5 million in legal fees, and a settlement now was financially prudent given the Supreme Court's rulings in two previous decisions. Goodale would not confirm or discuss the dollar figure paid to Khadr.

The Saskatchewan MP said the former Harper government stubbornly refused to repatriate Khadr for years; the government could have resolved this longstanding issue but instead decided to pursue a protracted legal battle "with virtually no chance of success."

The Justice Minister said the Supreme Court rulings demanded the government provide some kind of remedy.

Conservative Leader Andrew Scheer says the Liberal government's decision to compensate Omar Khadr is "disgusting." (Carolyn Dunn/CBC News)

"I hope Canadians take away two things today: Our rights are not subject to the whims of the government of the day, and there are serious costs when the government violates the rights of its citizens," Wilson-Raybould added.

Conservative Leader Andrew Scheer said it was "disgusting" for the government to concoct a "secret deal" and hand over millions to a convicted terrorist. "This payout is a slap in the face to men and women in uniform who face incredible danger every day to keep us safe."

Scheer said he believes the Harper government's decision to repatriate Khadr in 2012 was a sufficient response to the Supreme Court's ruling that Khadr's rights were violated. "The fact that [Khadr] is in Canada today is the remedy, that is the compensation," he said. "I would have refused to agree to this settlement."

Opposition Leader Andrew Scheer tells reporters in Calgary that the compensation deal for Omar Khadr is wrong 0:58

Scheer said Prime Minister Justin Trudeau is trying to shirk responsibility for the actions of previous Liberal governments by placing the blame on Harper.

"Let's be clear, this whole ordeal started under Liberal governments," he said, noting Canadian officials at Foreign Affairs and CSIS questioned Khadr at Guantanamo Bay in 2003 and 2004, when former prime minister Paul Martin was in power.

The information gathered was then used by U.S. officials as part of their efforts to extract a guilty plea from Khadr.

Former prime minister Stephen Harper also weighed in on the decision saying the Liberal government's decision to strike a deal with Khadr "is theirs, and theirs alone, and it is simply wrong.

"Canadians deserve better than this," Harper said on his Facebook page. "Today my thoughts are with Tabitha Speer and the families of all Canadian and allied soldiers who paid the ultimate price fighting to protect us."

'Restores a little bit my reputation'

In an interview with CBC News' Rosemary Barton, Khadr said he hopes the settlement will help restore his reputation.

"I think it restores a little bit my reputation here in Canada, and I think that's the biggest thing for me," he said, adding that he is sorry the apology or monetary settlement could cause pain for the family of the soldier he is accused of killing.

Omar Khadr speaks with CBC's Rosemary Barton 1:09

The settlement is similar to what was paid to Maher Arar in 2007 for Canada's role in a U.S. decision to deport him to Syria, where he was jailed and tortured.

The quiet money transfer came before a Toronto-based lawyer could file an injunction in an Ontario court to try to stop payment pending the settlement of a lawsuit launched by the family of the U.S. soldier Khadr is alleged to have killed in Afghanistan.

Tabitha Speer, the wife of the late U.S. special forces soldier Chris Speer, and Layne Morris, who was partially blinded in the firefight, won a $134-million US default judgment against Khadr in a Utah court two years ago.

Speer and Morris have sought to recoup some of the money owing from Khadr's settlement with the Canadian government. Those efforts are now in doubt.

Scheer, speaking to reporters in Calgary ahead of the Stampede, said secretly wiring the money before Speer could make her claim was "not just wrong, but disgusting ... contempt for the widow of a war hero. This shows such a mean-spirited attitude towards the true victims of his whole ordeal," he said, adding Khadr should hand over his settlement to the families of the U.S. servicemembers.

Speer had hoped to tie up the money in court, and make her claim to the funds before Khadr received his cheque from the government.

PMO clarifies position

Late Friday, the Prime Minister's Office issued a statement saying that what the Speer family has gone through is a "tragedy." The statement also said that the PMO expects the Speer family to seek redress through the courts and that the legal process in that regard should take its course.

"For anyone to suggest that a payment was rushed to avoid the Speers' legal claim is wrong and offensive," the statement said. "The payment was made in accordance with the court-assisted mediation scheduled months ago. A settlement was reached, and settlement funds were paid."

Khadr was 15 when he was captured by U.S. troops following the confrontation at a suspected al-Qaeda compound in Afghanistan.

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.

He pleaded guilty in 2010 to charges that included murder and was sentenced 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.