TORONTO (Reuters) - The United States is unsafe for would-be refugees and a Canada-U.S. agreement that compels asylum seekers to first apply for U.S. sanctuary ought to be ripped up, lawyers for refugees and rights groups argued in a Canadian federal court on Monday.

Under the Safe Third Country Agreement, asylum seekers at a formal Canada-U.S. border crossing traveling in either direction are turned back and told to apply for asylum in the country they first arrived in.

Lawyers for unnamed refugees who had been turned away are challenging the agreement, saying the United States does not qualify as a “safe” country under President Donald Trump. Human rights groups, including Amnesty International and the Canadian Council for Refugees, have also joined the case, which could change the way the two countries cooperate on refugee issues.

More than 50,000 people have illegally crossed the Canada-U.S. border to file refugee claims over the past three years, walking over ditches and on empty roads along the world’s longest undefended border. Some asylum seekers have told Reuters they might have stayed in the United States had it not been for Trump’s immigration rhetoric and policies.

Canada defends the agreement and wants to expand it. Since April 2018, it has been pushing to apply it to the entire border, in order to include people traveling outside of formal crossings.

On Monday, the plaintiff’s lawyers said Canada had failed to adequately review the United States’ status as a safe country.

Refugee lawyer Andrew Brouwer cited examples of asylum seekers being returned to the United States and subject to incarceration and solitary confinement for weeks, with little access to counsel.

Spokesmen for Canada’s Immigration Minister Ahmed Hussen did not return requests for comment on Monday. The hearing continues to Friday and the government is expected to mount its defense.