All children in Iran, even those who illegally emigrated from Afghanistan, have the right to go to school in the country, Iranian Supreme Leader Ayatollah Ali Khamenei told Iran’s Tasnim News Agency. “No Afghan child, not even immigrants who came to Iran illegally and without documents, must be kept from an education and all of them must be registered in Iranian schools,” the supreme leader said, according to Al-Monitor, a Washington, D.C.-based online publication that covers the Middle East.

Khamanei’s order was initially issued in December 2014, but it was revealed publicly Tuesday. The move was endorsed by Iranian President Hassan Rouhani, according to Rouhani spokesman Mohammad-Bagher Nobakth. “This is a thought-out order and the administration knows it to be its responsibility to carry out the order of the supreme leader with precision and in its entirety. The Ministry of Education also will perform its responsibility on this order,” Nobakth said.

About three million Afghan refugees are in neighboring Iran, with most of them coming in the last 35 years, when civil war, an invasion from Russia and the U.S. war led to instability. Hundreds of thousands of children will be impacted by the ayatollah’s ruling. Some 350,000 Afghan schoolchildren legally attend school in Iran while about 500,000 aren’t in school. “The problem is that their identity has not yet been determined,” said Rouhani adviser Alireza Rajaei.

Iranians have similar debates over immigration as other countries, including the belief that Afghan refugees are stealing their jobs and causing unemployment among Iranians. But Abdolreza Rahmani Fazli, Iran’s interior minister, said that was not the case. “The jobs that Afghans have taken are not the type of work that would be done by Iranian laborers; therefore, the job market has not been affected for Iranians,” he said. Tasnim also reported that province with little or no Afghan refugees have higher unemployment rates than those with a sizeable Afghan population.