German Chancellor Angela Merkel stunned the world in 2015 by announcing that she would allow nearly a million asylum seekers into her country, a humanitarian gesture offering hope to those suffering from the ravages of wars worldwide.

The move transformed her into the poster child for opening up international borders. High-profile German politicians, mainstream media outlets, and the public rallied behind the idea. Images of Germans welcoming refugees at train stations matched public opinion polls showing majority support for the new arrivals. To those who were feeling a bit nervous, the chancellor reassured them that the country and her government could "handle it."

But by 2018, the public mood had soured significantly. A new YouGov poll finds 72 percent of Germans saying their country's immigration policy is negligent, with only 12 percent saying it's about right. Last week, the reversal in public sentiment became official when the German chancellor ended a standoff with hardline immigration restrictionists in the government by dealing a mortal blow to the concept of open borders. She agreed to speed up deportations, to turn back refugees already registered in another European Union nation, and to let anti-immigration leader Horst Seehofer remain as head of the ministry charged with implementing these policies. She even acceded to opening "transit centers" along the border in Bavaria where refugees could be detained, though this provision was later dropped.

The deal is a dramatic repudiation of everything Merkel asked Germans to believe in just three years ago, which leaves many wondering: What on Earth went wrong?

The German Bureaucracy Did Not Deliver

Channeling a million migrants into productive lives in their new home is no small job, and in this case, government itself became a stumbling block. Germany's bureaucratic institutions were asked to review each application and grant or deny asylum, allow residence, or deport—as quickly as possible. They were also tasked with providing shelter, health insurance, food, and "integration" assistance in the form of language courses and job placement.

But even as officials worked to help the newcomers, restrictions designed to zealously protect native workers' jobs made the effort nearly impossible. Aside from needing legal status, in Germany, refugees face regulatory hurdles—from additional training and certification requirements to demands that they already know the language—before they can qualify for jobs at any level.

Germany's bureaucratic monolith, not exactly known for its efficiency, and resistant to rapid change, was expected absorb the sudden influx. And refugees' new lives hung in the balance. Without approved legal residency and permission to enter the job market, they could not hope to support themselves and contribute to society. Instead, hundreds of thousands of people would sit in camps, in limbo, living on taxpayer money, indefinitely. A report from the Institute for Employment Research found that just 10 percent of the working-age refugees who arrived in 2015 were employed by 2017.

Nothing good could come from such a situation. A series of high-profile refugee-related scandals followed, taking a toll on the nation's patience. Studies revealed that the new arrivals were not finding employment. The year 2016 began with reports of mass groping by foreigners in Cologne's central train station. There were a couple of murders committed by refugees, one of whose application had been denied but who was not deported. And a scandal erupted in Bremen after migration office employees allegedly took bribes in exchange for approving asylum applications.

Reports of ill-equipped public employees surfaced in the media. Local leaders openly denounced the German federal government's failure to provide needed resources. Merkel's own Interior Ministry began saying the refugee inflows were not sustainable.

Evidence was mounting that the bureaucracy was simply unable to "handle it," as the chancellor had promised.

Loosening Regulations Could Have Prevented This Crisis

There was never any room for error in Merkel's open-border policy. While empathy and solidarity led Germans to back her push initially, a deep appreciation for order and stability are also etched into the country's psyche. The uncertainty that resulted from three years of bureaucratic failures led to increased anxiety and eroded the public's support for immigration.

And the far right was lurking. Every error by the state, it claimed, proved that Merkel's efforts were a grave mistake.

The strategy worked. After the 2017 elections, the far-right Alternative for Germany (AfD), a euroskeptic-turned-anti-immigration organization, entered Parliament with the third most votes of any party. The result shocked and frightened the German mainstream, exposing the scope of the blowback to Merkel's failed refugee policy.

To save her party and her tenure, the weakened chancellor gave in to her more hawkish allies, inking this month's agreement to formally end the experiment in open borders and joining a long list of flip-flopping politicians willing to betray their convictions for political expediency.

Migration is still a must for Germany's future, thanks to worrying demographic patterns. Without a lot of new workers, the aging population and its shrinking taxpayer base will lay ruin to the country's generous welfare system.

But the country is stuck wondering how to successfully integrate such a huge mass of outsiders. This riddle is one shared by a number of countries worldwide.

Merkel could have enacted new immigration laws focused on easing barriers to employment. Admittedly, this would have required major policy changes for a risk-averse country, such as opening low-wage jobs to newcomers—but it would have helped avoid the idleness (and resulting boredom and frustration) that can push people to commit crimes, which in turn increases resentment among the native-born population. Instead, she threw the problem at a bureaucracy unaccustomed to dealing with high levels of immigration and hoped it would figure something out. The consequence has been plummeting support for refugees and a German people more bitterly divided than at any time since World War II.