A police officer carries the lifeless body of Aylan Kurdi, 3, from a beach where his body washed to shore on Wednesday. (Associated Press)

THE WRENCHING photographs of Aylan Kurdi , the 3-year-old Syrian boy whose body washed ashore on a Turkish beach this week, are an emblem of the moral and legal abdication of Western nations in the face of the worst refu­gee crisis the world has seen in decades. Hundreds of thousands of desperate Syrians, Afghans, Iraqis, Somalis and others have embarked this summer on dangerous voyages across the Mediterranean or arduous treks through southeastern Europe in the hope that rich, democratic nations will grant them safe harbor, in keeping with international law and their own commitments. To a shocking degree, they have been met with indifference, disregard or the cold hostility of razor wire and racism.

According to published reports, Aylan’s family was denied a refu­gee visa by the Canadian government and an exit visa by Turkey, propelling it into the overcrowded boat that capsized while attempting to reach Greece. The boy was one of more than 2,600 refugees who have died trying to reach Europe this spring and summer, a toll driven by the abject failure of the European Union to create safe and legal means for refugees to seek asylum.

The response to the crisis from leaders whose nations boast of their humanitarianism almost beggars belief. Britain has resettled just more than 200 of the 4 million Syrians who have fled the country, yet Prime Minister David Cameron this week claimed his government was taking its fair share. So far this year, Hungary has granted asylum to 278 out of 148,000 applicants, according to the United Nations, even though two-thirds or more of those applying are fleeing war zones and have a right to refuge under international conventions.

While Aylan’s body was washing ashore, another disgraceful drama was playing out at Budapest’s main train station, where authorities refused to allow thousands of refugees to board trains for Germany — even though German authorities stood ready to receive them. Hungarian Prime Minister Viktor Orban has built a razor-wire fence along his country’s southern border and promised to dispatch troops to stop asylum seekers. He has been shockingly blunt about his motivations: to defend “Europe’s Christian culture” from an influx of Muslims.

Such attitudes reveal the deeper stakes of the refu­gee crisis for the West. If intolerant demagogues such as Mr. Orban are allowed to prevail, then the European Union’s identity as a community of states committed to human rights and the rule of law will be shattered. As German Chancellor Angela Merkel put it on Monday, “If Europe fails on the question of refugees, if this close link with universal civil rights is broken, then it won’t be the Europe we wished for.”

Ms. Merkel’s response to the crisis has been a bright spot in a bleak landscape — a tableau of shame that extends to the United States, which has resettled fewer than 1,000 Syrians. Berlin, in contrast, now says it expects to register 800,000 refu­gee applications this year; it has loosened procedures for accepting Syrians and has approved 40 percent of the applications it has received. Germany is rightly calling for a revamping of the European Union ’s handling of refugees, including setting up a relocation system that relieves the burden on border states such as Greece and Italy.

An E.U. summit is due to consider the proposal on Sept. 14. Between now and then governments must decide whether Europe will be governed by the humanitarian principles of Ms. Merkel, or by Mr. Orban’s ugly chauvinism.