In a video message on Saturday, released on the World Refugee Day, Ghani expressed his gratitude to Ayatollah Khamenei for an order that requires all schools in Iran to enroll Afghan children.
Ghani also referred to his April visit to Tehran and the meetings he held with the Iranian officials, saying the two sides are in touch to reach agreements on the voluntary return of Afghan migrants to home, extension of their residence permits in Iran as well as provision of work permits.
Ayatollah Khamenei had already issued an order stressing that all Afghan children, even children of the undocumented migrants living in the country illegally, have the right to register and study in Iran's schools.
Back in May 2014, UN resident coordinator in Iran Garry Lewis appreciated the measures adopted by the Islamic Republic in hosting foreign nationals, saying Iran is the world's second biggest country accepting foreign refugees.
"Iran has very well hosted the refugees over the past three decades," he said, adding that preceded by Pakistan, Iran is the second country in the world that accepts the highest number of refugees.
Out of the total 880,000 registered refugees in Iran, Lewis explained, 840,000 are Afghans and the rest come from Iraq.
He also pointed to the living conditions of the foreign nationals in Iran, saying 97 percent of the refugees reside in the cities, while only 3 percent are located in refugee camps.
The high rate of Afghans living in cities is a sign that Iran has taken valuable measures for the refugees' health and occupation, Lewis noted.
The UN representative said some 10,000 Afghan refugees return to their country from Iran each year, stressing that stability should prevail in Afghanistan so that more Afghans would return home of their own volition.
Iran has hosted Afghan refugees since the late 1970s following the occupation of their country by the Soviet Union. Although many of those refugees have returned to their country voluntarily, there are still hundreds of thousands of documented and undocumented Afghans in Iran.