AMSTERDAM — When Ahmed Marcouch flew 1,400 miles from a small village in northern Morocco to this European capital in 1979, he felt he had not just moved a long distance but also traveled through time.

“It was like being in a time machine, like traveling 100 years into the future,” he said. “Everything was light, even in the streets. There were screens everywhere — in the village there was only one television. And women with all the differences in their hair and their clothes.”

Fast forward another 38 years to the present, and Marcouch is a Labour politician fighting for another term in the Dutch parliament, in an election that has become a referendum on his country’s orientation toward immigrants and refugees.

That Geert Wilders, the populist provocateur who has called Moroccans “scum” and pledged to “de-Islamize” the Netherlands, is poised to make a strong electoral showing here Wednesday testifies to the depths of anti-immigrant sentiment ascendant not just in the Netherlands but across the West. Wilders’s party, the Party for Freedom, is expected to be among the top vote-getters, and its success, even short of putting its leader at the helm of the country, could buoy far-right parties making a bid for power in elections later this year in France and Germany.

Marcouch’s path out of Morocco to the streets of the Netherlands, which he patrolled as a police officer before entering parliament in 2010, offers a counterpoint to the story of nationalist uprising in which foreigners feature only as a talking point of the far right. His is a story, shared by many migrants here, about the historic openness of the Netherlands, which first summoned his father as a guest worker but provided little by way of services and protections. An education and a more secure job gave Marcouch a platform to seek more active involvement in Dutch society and lay claim to Dutch identity.

He knows that problems remain, both in the discrimination ethnic minorities still face, especially in the labor market, and the disproportionate share of the crime they commit. But he sees fellow immigrants — whether first-generation or Dutch-born — seizing opportunities unavailable to previous generations. There are structural factors, such as the relatively low level of spatial segregation, that make this easier in the Netherlands than in other European countries, said Hein de Haas, a sociologist at the University of Amsterdam.

This progress, Marcouch said, is also where new forms of resentment originate, especially given the pace of change. To feel like you no longer recognize your surroundings — that can be wrenching, he said, drawing a parallel to his own experience of time travel as a small boy arriving at the Amsterdam airport. The population of the Netherlands grew by more than 110,000 in 2016, driven by a net migration of 88,000, mostly from Syria, according to the Dutch Central Bureau of Statistics. People with a foreign background now represent 22 percent of the population.

In a way, then, Dutch society is being remade along new ethnic lines. The chairwoman of the Dutch parliament, Khadija Arib, is a Dutch-Morrocan Labour MP. Ahmed Aboutaleb, the mayor of the port city of Rotterdam, is a dual citizen.

“We have boys in military positions, we have specialists in the hospitals, we have businessmen,” Marcouch said. “The majority of Moroccan girls and boys are doing very well. They’re better at taking positions, at assuming they can belong.”

Over the past 15 years, integration — measured by education, employment and language proficiency — has progressed, said Borja Martinovic, a scholar of immigration and intergroup relations at Utrecht University. Immigrants are having more contact with the native population, particularly among the second generation, she said, and it is often in areas with the fewest immigrants that anti-immigrant views are most potent.

When there is integration without full assimilation, Martinovic said, minority groups begin to assert themselves — “they want to have their voices heard, they might even want some power in society.” This threatens a sense of “collective ownership,” she said, “this sense that we as a dominant group are entitled to run this country, to decide on who comes in and who is left out. If you look at the campaign of Donald Trump or the Brexit campaign, they were all about us taking control of our borders, giving the country back to our people. That seems to have a lot of electoral appeal.”

The appeal is not new in the Netherlands, said Gijs de Vries, a former counterterrorism coordinator for the European Union who left the ruling People’s Party for Freedom and Democracy in favor of Democrats 66. These sentiments have existed for a number of years, de Vries said, particularly since two high-profile political murders, in 2002 and 2004, that roiled the country in the aftermath of the Sept. 11, 2001, attacks in the United States.

What is new, he said, is the emulation of this discourse by more mainstream parties, pulling prevailing political attitudes to the right. A signal moment came in January when Mark Rutte, the center-right prime minister, published an open letter telling newcomers to “behave normally, or go away.”

This pivot has opened up space for more minor parties to proclaim an adamantly pro-immigrant message. Not just Labor but also the Greens have taken up this message, as have members of Denk, or “think,” a renegade party that rails against the establishment, but from the opposite pole of Wilders.

But the Greens appear to be reaping the rewards, with their support surging in the days before the election.

“We are among the few parties who say that with 65 million refugees worldwide, of which 95 percent is taken care of in the poorer countries of the world, we should do more instead of less,” said Bram van Ojik, a former leader of the Greens who is seeking to return to the House this year. “That is not a common position. Most parties say no, we are toward the limit of what we can deal with, and people don’t want it. We try to shed light on the other side of the coin.”

The position has resonated with two medical students at the Vrije Universiteit in Amsterdam, Salima Talib and Duygu Talan, both 27. Both were born in the Netherlands to Moroccan-born parents. They were drawn to the Greens because of their health-care plan and because of the charisma of the party’s leader, Jesse Klaver, who projects tolerance, they said.

Talib said Wilders’s insults do not frighten her. She feels secure in this country, more so, she knows, than did her grandfather, who first came here for work and found little more.

“That generation, they were workers. They didn’t talk about things,” she said. “We have a voice. We are well educated. Mr. Wilders is threatened by how well we are participating in our communities.”

Read more: