During the last months of the Justin Trudeau Liberals’ first mandate, Bill Blair, then minister of border security and organized crime reduction, had discussions with officials in the United States about how to strengthen the so-called Safe Third Country Agreement (STCA).

With more people seeking asylum in Canada, the Liberals had two choices before them: cancel the agreement and allow people to claim refugee status at official ports of entry or extend the agreement to the entire border, effectively making it impossible for anyone coming from the U.S. to seek asylum.

The Liberals chose the latter option, siding with Stephen Harper-era logic that either sent asylum seekers back into U.S. custody or forced them to find creative ways to come into Canada while avoiding official ports of entry, and then make an asylum claim.

On July 22, the Federal Court found that the STCA is a violation of the Canadian Charter of Rights and Freedoms. The court has given the government six months to either scrap the agreement or launch an appeal.

Refugee and human rights organizations have consistently condemned the STCA. At a time where there is unprecedented migration around the world, it effectively shut Canada off to asylum seekers from the most accessible points of entry. The NDP has also called for the agreement to be scrapped. Last week, NDP MP Jenny Kwan insisted that the Liberals formally notify U.S. President Donald Trump that the agreement is off.

So, why did it take a federal court decision to force the Liberals to face the fact that it placed so many people’s lives in danger?

The Liberals are masters of trickery. Their 2015 election campaign and the subsequent honeymoon was due in large part to their positive rhetoric about refugees. After nearly a decade of Harper, many Canadians were relieved to hear their prime minister would publicly welcome more refugees rather than hire agents to pull people off inbound flights if they believed they’d make a refugee appeal upon landing.

But the way in which Trudeau’s government has managed the border has demonstrated the Liberals are far closer ideologically to the Conservatives than they want Canadians to believe. In only one year, the Liberals went from building political capital on welcoming migrants to finding ways to close Canada’s border off to them.

The STCA was developed in the aftermath of 9/11. Canada and the U.S. considered each other’s country to be “safe,” and so anyone who sought asylum in either country could be reasonably expected to be treated well. It was signed by the Jean Chrétien government in 2002, and came into effect under Paul Martin’s government in 2004.

When Trump came to office, there was an increase in people seeking entry into Canada. Many were from Haiti, and had been living in the U.S. due to a temporary settlement agreement after the devastation of the 2010 earthquake in the country. Facing potential deportation, many came north through Quebec border crossings, and sought asylum.

These folks faced racism from everywhere: journalists who misunderstood the STCA and wrote about “illegal immigration,” racist commentators, racist politicians, and racists in general. The racist rhetoric surrounding border crossers arguably gave Maxime Bernier’s People’s Party of Canada the push it needed to break into the mainstream. The Conservatives have also had great success in using racist rhetoric on this issue to shore up the part of its base who would identify as “old-stock Canadian.”

By the time March 2019 came around, the Liberals had to decide how to position themselves in relation to the fall election. Rather than resisting the racist logic that had saturated mainstream border discussions, they promised to expand the STCA to the entire border, and pour more than $1 billion into enforcement over the next five years.

Not quite Trump’s border wall, but really not too different either. Whether a wall or legislation, the message was clear: Canada doesn’t want to accept migrants who come from the U.S., even as stories of ICE holding children in cages, or raiding peoples’ homes, were making regular headlines.

The Federal Court’s decision is a body blow to the Liberals, and should serve as a wake-up call to their voters who claim to support migrant rights. The Conservatives are already frothing at the mouth, promising to defend the agreement and keep Canada’s borders closed. The Liberals must scrap the agreement now, and work with migrant justice communities to reform racist border legislation.