Canada said it would take back 23 of its citizens who were held in Islamic State camps in north-east Syria.
The group includes six women, 13 infants, and four men.
British-Canadian dual national, Jack Letts, whose British citizenship was revoked, is among the men who will be brought back.
Lawyer Barbara Jackman, representing one of the four men, said the parents were happy with the court’s decision.
The judge asked that the men should be repatriated “as soon as reasonably possible,” Ms Jackman said.
The repatriation would be the largest so far for Canada after the so-called Islamic State caliphate was destroyed in 2019.
The decision to bring back the detainees comes after relatives took the Canadian government to court and argued that preventing them from entering Canada would violate their constitutional rights.
Canada’s government has until now responded to detained IS families on an individual case-by-case basis. In four years only a handful of women and children have been brought home.
The foreign ministry said in a statement that “the safety and security of Canadians is our government’s top priority”.
Germany, France, Spain and Netherlands have also repatriated its citizens from Syria.
Last year, the UK took back two UK nationals from the camp after they were reportedly identified as human trafficking victims.
Shamima Begum, who left Britain to join IS as a school girl in 2015, was stripped of British citizenship and banned from entering the UK.
More than 42,400 foreign citizens, most of them children, have been held in life-threatening conditions in IS camps across Syria, Human Rights Watch says.
source: bbc