In the early days of the Russian invasion, the European Union took an extraordinary action: It granted the hundreds of thousands—soon to be millions—of Ukrainian refugees the automatic right to live, work, and move freely within the bloc for at least a year.

The unanimous decision by all 27 member states to invoke the Temporary Protection Directive—created over 20 years ago in the wake of the Yugoslav Wars but never before deployed—gave Ukrainians access to social services like housing, education, and health care without their having to go through the laborious nation-by-nation asylum process. The institutional support is a sliver of solace for the 3 million Ukrainians who have escaped Russian bombardment and had their lives shattered by war. There are also the smaller acts of compassion: the hot tea and sandwiches handed out by volunteers and border guards, the strollers left for Ukrainian families at railway stations, the offers of free transport to people’s friends and family.

But the swift aid rendered to them also brings into sharp relief the hell that non-white asylum seekers have endured when they have tried to escape equally harrowing circumstances. When Syrian, Afghan, Iraqi, and other refugees came to European shores seeking safety, border guards sometimes violently pushed them back, while conservative politicians and parts of the population treated them with suspicion and contempt. They were often pushed back from borders by violent force and met with xenophobic contempt. In the United States, seeking asylum at the southern border remains nearly impossible for Central Americans and others as the Biden administration continues the mass expulsions begun by its predecessor. The vastly different receptions speak to the racism and incoherence at the heart of the world’s asylum systems.

Judith Sunderland, associate director of the Europe and Central Asia division at Human Rights Watch, says the outpouring of solidarity for Ukrainians shows that a compassionate, humane response to a refugee crisis is possible, even when dealing with a huge and chaotic flow of migrants.

“It is really an important moment. Everybody who works on these issues, we’re asking ourselves how we can seize this moment to say, ‘Well, look, this is Europe at its best.’ That it can manage a massive influx of people in a way that is humane and that respects their rights and is manageable. It can be done,” she said. “It’s what we would want to see in reaction to people in need of our support all the time, but it does stand in very, very stark contrast to everything I have been documenting and thinking about and seeing play out before my eyes over the past decade.”

At the height of the Syrian war, that conflict, as well as upheaval in the Middle East and parts of Africa, drove millions to try to cross into Europe through perilous sea routes in the Mediterranean. The crisis reached its zenith in 2015, when a record 1.3 million applied for asylum in the EU, with another 1.2 million applying in 2016.

European nations responded by trying to pass off their responsibilities and keep asylum-seekers out of their own territories. Asylum in the European Union is governed by the Dublin regulation, which requires asylum seekers to stay in the country they first arrive in until their claims are processed. Because Italy and Greece are most accessible to migrants, the burden for handling the enormous stream of arrivals fell to them. Their solution was to stash refugees in sprawling, squalid encampments on the outskirts of the continent that became notorious for appallingly inhumane conditions. Human Rights Watch called the far-over-capacity Moria refugee camp on the Greek island of Lesbos an “open air prison,” where families slept in flimsy, cramped tents for months without access to enough toilets or showers.

Other countries, like Austria, Poland, and Hungary, sealed their borders to migrants altogether as right-wing, anti-immigrant governments came to power. In a particularly craven maneuver, the European Union refused to expand search-and-rescue operations in the Mediterranean, leaving more than 1,000 migrants to drown at sea every year since 2014.

A proposal to activate the Temporary Protective Directive for those arriving through the Mediterranean was briefly considered in 2015 and promptly shelved. Officials worried that it would, in the dehumanizing language of bureaucracy, be a “pull factor” and encourage even more migrants to make the journey.

“We can’t not notice that the people that European countries try so hard to keep out are often brown and Black,” Sunderland said. “They’re from Africa, the Middle East, and Asia, and some of them are Muslim, some of them practice other religions. They come looking differently, dressing differently, and praying differently, and they are treated very, very differently than Ukrainians.”

The United States, if anything, has taken an even more punitive, hard-line stance on asylum-seekers, prizing deterrence above all else. The Trump administration pursued a series of policies that criminalized seeking asylum on the southern border, where scores of Central Americans arrive seasonally, fleeing gang violence and instability that the US helped sow in the region. In the most infamous and barbaric episode, the White House instructed the Justice Department to prosecute asylum-seekers for illegally crossing the border, leading them to be forcibly separated from their children. Parents were taken to detention or deportation while their children got lost within the foster system.

Although the Biden administration ended the practice of family detention late last year, asylum in the US has never centered around a humanitarian response. It’s telling that the agencies responsible for receiving migrants—US Customs and Border Protection and Immigration and Customs Enforcement—are the ones created as part of the post-9/11 national security infrastructure. The first stop for an asylum-seeker in the United States is not a welcome center with hot tea and sandwiches but CBP processing facilities known as “hieleras,”or iceboxes, where families with children huddle in cage-like cells under Mylar blankets. Last year, images of border agents mounted on horseback brutally attacking Haitian asylum-seekers and pushing them back into Mexico across the Rio Grande drew widespread condemnation.

Even now, the Biden administration is barring the vast majority of asylum-seekers from having their claims of persecution heard at all. Despite repeated pleas and a lawsuit from advocates, it has refused to end the use of Title 42, a public health order intended to curb the spread of Covid-19 that has so far been employed to expel 1.3 million migrants with no screening or assessment whatsoever. Other migrants who cannot be easily returned to their home countries are funneled into the Remain in Mexico program, another Trump-era innovation that forces vulnerable migrants to wait out their asylum cases in dangerous border towns in Mexico. Meanwhile, the Department of Homeland Security issued a memo last week directing border officials to exercise their discretion and consider exempting Ukrainians from Title 42 if they try to enter through the southern border.

“There’s a lot of arbitrariness in who even gets the ability to seek asylum,“ said Yael Schacher, the deputy director for the Americas and Europe for Refugees International, an advocacy group. “Which asylum procedure you get and what access you get has nothing to do with the merits of your claim. It has to do with managing flows at the border and what enforcement is available to the administration.”

The Biden administration has enrolled a record number of families in alternative-to-detention programs while they wait to see an immigration judge, but even those can involve overbearing surveillance, like electronic ankle monitors and house arrests managed by private prison companies.

“I haven’t heard of any house arrest programs for Ukrainians,” Schacher said. “My goodness, it’s so hard for us to get away from the detention and surveillance mode.”

The US asylum system requires decisions to be made on an onerous case-by-case basis. Applicants must prove they are being persecuted based on at least one of five protected categories: race, religion, nationality, membership in a social group, or political opinion. As increasing instability is projected to displace an estimated 1 billion people worldwide by 2050, a more generous standard applied to broader groups of people would be ideal, Schacher said—for instance, victims of domestic violence or those pushed from their homes by climate change. But that is the option that seems the most politically infeasible. Border politics remain toxic around the world.

The story of Ukraine’s refugees is not finished yet either: European nations now face the gargantuan task of providing housing, health care, and educational opportunities to millions of newcomers, while integrating them into society. Already, some cities are feeling the strain. It’s anyone’s guess how long the goodwill and hospitality will last.

International law governing asylum grew out of the atrocities of the Holocaust, when so many nations sent Jewish refugees to their deaths. But the world’s current systems for addressing such crises have become warped, selectively meting out solidarity and suffering. The embrace of Ukrainians offers both a lesson and a guidepost: Circumstances can make anyone a refugee, and with enough imagination and political courage, a radical new path for caring for the vulnerable is possible.