Prime Minister Stephen Harper says he might appeal a court ruling which states that Ottawa must immediately seek the repatriation of Omar Khadr.

"The facts, in our judgment, have not changed," Harper said in Parliament Thursday. "We will be looking at the decision very carefully and obviously considering an appeal."

Harper's comments came after a federal court judge ruled that the Charter of Rights and Freedoms obligates the prime minister to try to bring Khadr, currently jailed in Guantanamo Bay, back to Canada.

In a 43-page ruling, Judge Walter O'Reilly said Harper should take action immediately.

"The ongoing refusal of Canada to request Mr. Khadr's repatriation to Canada offends a principle of fundamental justice and violates Mr. Khadr's rights," O'Reilly wrote.

"To mitigate the effect of that violation, Canada must present a request to the United States for Mr. Khadr's repatriation as soon as practicable."

The judge also heard arguments from Khadr's lawyers that the prime minister should have sought repatriation because Canadian interrogators deprived Khadr of sleep before questioning him -- a practice some have likened to torture.

"Khadr was then a 17-year-old minor, who was being detained without legal representation, with no access to his family, and with no Canadian consular assistance," the judge wrote.

Despite mounting pressure, the government has taken a hands-off approach to the fate of Khadr, who was arrested seven years ago as a 15-year-old for allegedly killing a U.S. soldier in Afghanistan.

Now 22, Khadr has been in Guantanamo Bay for six years and legal hearings against him have been suspended pending a review of his case.

Khadr's fate was put in a holding pattern after U.S. President Barack Obama decided earlier this year to close Guantanamo Bay.

However, that plan is in jeopardy as U.S. officials grapple with the prospect of sending suspects back to countries like Yemen, which have strong terror networks and inadequate penal resources to deal with an influx of prisoners, The New York Times reported.

Still, Khadr's Pentagon-appointed military lawyer welcomed the decision and said it recognizes the government's responsibility to act.

"We think the court is essentially saying what we've been saying for a number of years now," Lt.-Cmdr. Bill Kuebler told CTV's Power Play.

He added that several aid organizations have put together a plan to rehabilitate Khadr and that any more legal wrangling is delaying the inevitable.

Opposition MPs in Ottawa seized on the court ruling Thursday to slam Harper's handling of the file.

Liberal Leader Michael Ignatieff, speaking in Washington, said: "My view of the obligations of the government of Canada is you don't get to pick and choose which Canadians overseas you defend, you have to defend them all, that's what a passport means."

NDP Leader Jack Layton said Harper is clearly out of touch.

"Evidently, Mr. Harper . . . is prepared to not only ignore the will of Parliament which has called for his repatriation, ignore international law, and the precedent being set by other countries but is now prepared to ignore federal court."

With files from The Canadian Press