Before Mrs. Waziri became ill, her family said, she was a pioneering woman’s rights activist and teacher, who was among the first women in Afghanistan to publicly remove her veil, shake a man’s hand and run for Parliament, in the late 1960s.

Countries across Europe have been tightening immigration rules as anti-immigrant sentiments simmer on both sides of the Atlantic. A tough stance on refugees has become such a vote-getter in Denmark that the integration minister, Inger Stojberg, recently celebrated the government’s 50th anti-immigration regulation with a cake.

Such hardening attitudes are not limited to Denmark. In Germany, which accepted more than one million refugees and migrants in 2015 and faces elections in September, three mass expulsions of Afghan men have occurred since last fall. Hungary, evoking echoes of World War II, recently unveiled plans to detain asylum seekers in small enclosed villages surrounded by razor wire.

Denmark’s tightening rules do not concern only those from war-torn countries. Mary Stewart Burgher, a 60-year-old retired Houston native who worked for the World Health Organization in Copenhagen, became a cause célèbre in Denmark this month after she was ordered to leave after living there for 32 years. After she made several heartfelt pleas on television in American-accented Danish, she was notified the day before her planned deportation that she could stay, at least while the authorities reviewed her case.

Fears are growing in Europe that incoming terrorists are masquerading as refugees and that welfare states are being overstretched. In Denmark, a culture war over Islam exploded after the publication of cartoons lampooning the Prophet Muhammad in a Danish newspaper in 2005 spurred a violent reaction around the world.

Aarhus, where the Waziri family lives, has attracted unwanted attention for its gritty immigrant neighborhoods, but has also gained notice for a successful program to deradicalize jihadists in a country with the second-highest number of foreign fighters per capita.