In 2015, the leader of Iran, Ayatollah Ali Khamenei, called on Iranian education officials to register Afghan children, both documented and undocumented, in public schools across the nation.
Census data released by Iran's Statistical Center shows that more than 95 percent of migrants in Iran originated from Afghanistan and that their number exceeds 1,500,000.
Prior to Khamenei's mandate, schools refused to register undocumented migrant children.
Nader Mousavi, a sociologist at Tehran University, told DW that the mandate was very effective, and enabled three-quarters of illegal Afghan children in Iran to attend school.
Mousavi, who himself is an Afghan national, has been the manager of a local school for Afghan children in Tehran for 19 years. He said that directly after the mandate, 200 of 300 students at the school could find their way into Iranian public schools.
Local authority schools are non-governmental and run by Afghans for Afghans.
The schools were not recognized by Iranian officials until a year ago and they were usually attended by illegal Afghan migrants.
Graduates from these schools were given a certificate from the Afghan consulates or embassy. Prior to Khamenei's mandate, these schools were often shut down if discovered.
Education without social acceptance?
"The social stage is still not set for a change towards the way Afghan migrants are viewed publically in Iran," Akram Khatam, a rights activist, told DW.
However, some experts see attitudes toward Afghan migrants are headed in a positive direction. Afghan educator Mousavi says he has witnessed a major change in the past five years.
"Iranians, particularly the younger generation, are extending sympathy toward Afghan migrants for the hardships they have gone through. More and more Iranians are standing behind Afghan migrants in asserting their rights," he said.
On Twitter, the so-called "Mehr Hashtag" was created by a number of Iranian child rights activists a few weeks before the start of the 2017 school year to draw attention to the need for education of young Afghan migrants.
Mousavi believes the Mehr Hashtag and related activities on social media platforms set good examples in Iranian civil society. "The move made the education minister to promise on his Twitter page that this year, no Afghan child would be deprived of an education," he said.
Challenges for Afghan students in Iran
Khatam points out that there are still big challenges faced by Afghan students in Iran. "There are pre-conditions for getting registered at schools in Iran which many Afghan kids can't fulfill," she said.
Khatam identified knowing the Persian language, coming along with one of the parents for the registration day as well as providing identification documents as requirements that can prevent Afghans from getting registered at Iranian schools. The payment of fees is also a problem.
But Mousavi says that public schools do not always take fees from students, adding that that there are some schools which are run by boards of trustees, which require the same amount of tuition payments from both Iranian and non-Iranian students.
"Even at these schools, managers take a more lenient approach towards low income families, including Afghans," he said.
"I know of many cases where payment is allowed in instalments," he said, adding that in other cases, for extended families, schools completely drop one tuition fee due to the family's income.
Difficult to track young Afghans
Civil activists together with child rights experts made an effort five years ago to find out the number of out of school children in Iran. It is estimated that the number stands at 400,000 or 500,000.
"The number is big enough that it requires a serious attempt to change the situation," said Khatam.
"Very recently, experts reported that the number even rose to 1 million. Since there are no previously gathered statistics, it remains an estimated figure," she added.
Regarding the difficulty Afghans face in getting into Iranian schools in Iran, Mousavi categorized younger Afghan migrants into three categories.
"The first group does not possess any legal status and are undocumented. The second group is documented, but have moved to larger cities to find occupations, and the third group is not eligible to attend schools due to age limits or their lower level of education," he explained.
Calls for change
Iranian civil society has intensified pressure on the government to offer equal education opportunities for all migrant children. "A surge in the Iranian migration overseas revealed the fact of how different Iranian junior expatriates are being treated abroad. Other countries do have a more humane approach towards their migrant children than us," said Khatam.
Sociologist Mousavi says the third generation of Afghan migrants in Iran considers Iran as a springboard and mostly migrates to Europe in the hope of for a better future and equal rights.
"Despite the improved social atmosphere towards migrants' broader educational perspectives for Afghans, there is still little hope for educated Afghans to find suitable jobs in Iran," he said. "And the inequality towards them still exists."