What happened
Merkel's decision in the late summer of 2015 was, on humanitarian terms, defensible and in some readings admirable: Germany took in more refugees per capita than almost any comparable wealthy nation, at a moment when Syria's civil war was producing the largest refugee crisis in Europe since the Second World War.
What the government did not do was build the administrative and social infrastructure to match the scale of the decision. Local authorities were left to improvise housing, often in sports halls and temporary camps, with little federal coordination. Integration and language provision arrived slowly and unevenly across states. Public opinion, initially sympathetic (the 'Willkommenskultur' of late 2015), soured over the following eighteen months as visible strain on local services and, following the Cologne assaults that New Year's Eve, on public safety, became impossible to ignore.
The AfD had polled below 5% before 2015. It entered its first state parliaments in March 2016 and the Bundestag in 2017, directly on the back of the refugee policy backlash — making this arguably the single most consequential domestic policy decision behind the AfD's transformation from a fringe eurosceptic party into a mass movement.