By Jessica Donati
KABUL (Reuters) - Iran said it had agreed to extend temporary visas for 450,000 Afghan refugees for six months, lifting a threat to send them back home to a country facing attacks by resurgent militants.
Afghanistan -- struggling to cope with hundreds of thousands of people left homeless inside its own borders by a wave of violence -- this month asked its neighbour not to expel the Afghan refugees who did not have the right documents.
Kabul said 760,000 refugees were at risk and it was not immediately clear what would happen to those who did not receive extensions.
"(Temporary visas) have been extended for six months based on the brotherly relations between our two countries," Iran's foreign ministry said in a statement released late on Friday.
Afghanistan had agreed to come up with a plan on how to help the refugees within two months, the ministry added.
The United Nations expects 765,000 people displaced inside Afghanistan to need its help by January 2015, up from 631,000 the previous year.
There are almost 1 million registered Afghan refugees in Iran, according to the United Nations, most of whom arrived before 2001 when U.S.-led troops toppled the Taliban Islamist regime.
Those who arrived afterwards have to get their permits assessed on an individual basis, making it harder for them to obtain the paperwork needed to be officially registered, according to the United Nations' refugee agency.
(Additional reporting by Mirwais Harooni and Hamid Shalizi)