While Iranians bear the brunt of Donald Trump's visa ban, which came into force last week, international officials say their country has quietly emerged as one of the most generous towards refugees.
"The leadership demonstrated by the Iranian government has been exemplary in hosting refugees and keeping borders open," said Sivanka Dhanapala, who heads the UN High Commissioner for Refugees team in Tehran.
"It's a story that's not told often enough."
Iran has been sheltering a million registered Afghans for almost four decades, and NGOs estimate there are some two million more living under the radar.
That's the fourth-largest refugee population in the world, the UN says.
Trump's new visa ban on six mostly Muslim nations will have a particularly tough impact on the one million Iranians living and studying in the US, as well as their families.
Foreign NGO workers have noted the irony that Iran is targeted by the ban while it continues to deal with huge numbers who have fled an American-led conflict.
Dhanapala highlighted the 2015 decree by supreme leader Ayatollah Ali Khamenei ordering schools to take in all Afghan children, documented or not -- a move that left authorities scrambling to build the equivalent of 15,000 new classrooms.
"We've also worked with the government on incorporating refugees into a government-sponsored health insurance scheme which is a ground-breaking development not just for Iran but globally for refugees," Dhanapala said.
Officials are well aware that Afghans still face a harsh existence in Iran.
As in many countries, Iranians are less than pleased to be hosting so many poor foreigners, especially when their economy has been battered by years of sanctions and mismanagement.
The result is that Iran does a lot to discourage Afghans from staying, rounding up the undocumented and sending them home.
"Even someone like me, who was born in Iran and has lived here 36 years is not yet an Iranian citizen and the discrimination I face in my education and work is suffocating," said one Afghan, a relatively well-established professional in Tehran, who asked to remain anonymous.
He is still grateful for his residency permit, which must be renewed every six to 12 months.
"I have never seen Afghanistan, except for the bad images on the media and I truly fear returning," he said.
"But for 36 years, I have lived in fear of my residency papers not being renewed and it has made life bitter for us."
Life in the shadows
Many Afghans are in Iran for work, and are a perennial sight on the margins of Tehran life as construction workers, parking attendants and rubbish-pickers.
"What else can we do? I have two daughters and a son back in Afghanistan," said an undocumented 40-year-old who works as a cleaner and also asked not be named.
He gave up his refugee card so he could visit his family, and came back to Iran with a three-month visa which he could not renew.
"I haven't visited home for three years. If I go, it takes five to 12 months to get another visa," he said.
He was 14 when he fled the Soviet war in the 1980s.
"When they catch you on the street, it doesn't matter if you've been here one year or 100, they take you to the deportation camp and make you pay for the bus back to the border," he said.
"I've been sent back a few times. Either you wait for a new visa or come illegally with traffickers. I don't use the traffickers -- it's horrible."
Foreign governments have also accused Iran of rounding up young Afghans to fight in Syria.
Iran denies any coercion or government sponsorship, saying they are volunteers, though the families of those killed are given special privileges.
Meanwhile, some NGO workers privately criticise the rough treatment of Afghans, especially in border regions, but all agree Iran deserves far more credit for the burden it has accepted.
The UN hopes Iran will ease restrictions on which jobs Afghans can do, and would like a formal registration process for the undocumented, although it understands fears that this could attract yet more migrants.
But, said Dhanapala, "in a world where you have multiple bad stories about hosting refugees, I think Iran is really a good news story".