Sweden, once one of the most welcoming of nations for immigrants and long considered “a moral superpower,” as the political scientist Lars Tragardh put it, has experienced a rise in anti-immigration sentiment amid increasing globalization, immigration and anxiety about national and cultural identity.

The episode occurred days after a prominent TV investigative program reported on racial profiling in Sweden. TV4’s “Kalla Fakta” spoke with about 100 Swedes with foreign backgrounds who said they had been stopped, checked and treated by the police in a disparaging and condescending way.

John Stauffer, chief legal counsel with the Stockholm-based Civil Rights Defenders, said by phone that ethnic profiling was widespread. The rights group published a report on the issue in 2017, showing that people were being stopped, questioned and controlled.

“We can see that people experience being profiled on a daily basis and in everyday situations, such as on the subway system, on the way to work and school, moving around in public places,” he said.

Interviews on Sunday with the woman — who insisted on being identified only by her given name, Jeanine, because she feared for her safety — and with others revealed that she is originally from the Democratic Republic of Congo and worked at a beauty salon.

She said that she had been on her way to the hospital with her 5-year-old daughter on Thursday evening because she was having contractions. She said she had her travel card with her at the time but could not find it. By the time she pulled it from her pocket, she said, the ticket controller had already issued a fine.