Image copyright Toronto Star via Getty Images Image caption Canadian officials used Ebrahim Toure's DNA in an attempt to establish his nationality

Canada is using DNA and commercial genealogical sites to help determine the nationality of migrants whose origin is in question.

The Canada Border Services Agency (CBSA) has confirmed the use of DNA testing "when other avenues of investigation have been exhausted".

The agency could not confirm how frequently such techniques are used.

One Canadian immigration lawyer says he is personally aware of a handful of such cases.

CBSA spokesman Jayden Robertson said the agency uses DNA testing to assist "in determining identity by providing indicators of nationality thereby enabling us to focus further lines of investigation on particular countries".

"The CBSA obtains consent from the clients before submitting their information to DNA websites," he said in a statement to the BBC.

Toronto-based immigration lawyer Subodh Bharati says he is concerned about how well the privacy of those whose DNA has been collected is being protected.

One such case involved Mr Bharati's client Franklin Godwin, who arrived in Canada in 1994 on a fraudulent Bahamian passport and requested asylum after disclosing to immigration officials that he was Liberian. He was granted refugee status and permanent residency.

He later lost his permanent residency status after being convicted on various drug charges.

Canada sought to deport Mr Godwin in 2003 and in 2005.

Liberia twice denied him entry despite issuing him travel document. In the latter instance, officials claimed he was not Liberian but Nigerian.

Mr Godwin maintains his Liberian nationality but Canada is seeking to confirm his identity.

In 2017, while being held in detention by the CBSA, officials conducted a linguistic test, an interview about his knowledge of Liberia and a DNA test.

Using genealogy websites, they found two distant relatives who claimed Nigerian ancestry and contacted them.

Mr Bharati says he doesn't believe that DNA testing offers Canada much value in determining someone's country of origin.

"It's clear DNA doesn't give someone's nationality," he said.

In another instance reported by AFP, DNA was used to attempt to establish the nationality of Ebrahim Toure, a failed refugee claimant who has been detained by Canadian immigration officials since 2013, pending his removal.

According to AFP, he had arrived in Canada on a fake French passport. He later claimed to be from Guinea, but was refused entry by Guinean officials.

Following a linguistic test, a search of his social media that revealed he had many Gambian acquaintances, and interviews with friends in Canada, officials sought to match his DNA with relatives in The Gambia.

The Toronto Star reports that Mr Toure says his transient upbringing complicates his nationality. He remains in detention.

In a statement to BBC, an Ancestry spokesperson said that protecting customers' privacy is the company's "highest priority".

"That starts with the basic belief that customers should always maintain ownership and control over their own data," the company said.

It said it does not work with border agencies.

FamilyTreeDNA told Vice News that the company does not work with Canadian law enforcement and has no knowledge of its platform being used to determine a migrant's nationality.