Prime Minister Justin Trudeau says settling with Omar Khadr was the "responsible path to take" because letting the case play out in court could have cost the government as much as $40 million.

"I can understand Canadians' concerns about the settlement. In fact, I share those concerns about the money; that's why we settled," Trudeau said from the Senate foyer where he was announcing Canada's new governor general.

"If we had continued to fight this, not only would we have inevitably lost, but estimates ranged from $30 to $40 million that it would have ended up costing the government," he said. "So this was the responsible path to take."

Trudeau said Canada is a country that stands up for people's' rights and he hopes future governments learn from this experience in the years to come.

"The measure of a society, a just society, is not whether we stand up for people's rights when it's easy or popular to do so, it's whether we recognize rights when it's difficult, when it's unpopular," Trudeau said.

Earlier this month, the federal government formally apologized to Khadr, giving the former Guantanamo Bay prisoner a reported settlement of $10.5 million.

In 2002, when Khadr was 15, he was captured by U.S. troops in Afghanistan after a firefight that resulted in the death of U.S. Sgt. Christopher Speer and the wounding of U.S. Sgt. Layne Morris.

In 2010, before a military commission in Guantanamo Bay, Khadr admitted to throwing a grenade that killed Speer and blinded Morris in one eye.

Khadr has subsequently recanted that admission, arguing that he only made the confession because he had been tortured and wanted to return to Canada. He is seeking to have the conviction overturned on appeal in the U.S.

In 2015, a U.S. court in Utah awarded Speer's widow, Tabitha, and Morris $134.1 million US in a judgement against Khadr, based largely on the 2010 conviction. Both are trying to get a hold of Khadr's settlement through the courts.

Suing for damages

In 2010, the Supreme Court of Canada ruled that Canadian officials had failed to protect Khadr's rights under the Charter of Rights and Freedoms while he was detained in Cuba.

Based on that ruling, Khadr's lawyers were suing the federal government for $20 million in damages.

In announcing the settlement, Public Safety Minister Ralph Goodale said Khadr's court proceedings had already cost the government $5 million in legal fees, and a settlement was financially the prudent move given the Supreme Court's ruling.