Afghanistan and Iran have agreed to a prisoner exchange, the Afghan foreign ministry in Kabul said on Thursday, a sign of warming relations between the two neighbours ahead of the planned withdrawal of foreign combat forces from Afghanistan in 2014. Thousands of Afghan prisoners are held in Iranian jails, some awaiting the death penalty for narcotics trafficking, and their incarceration caused tension between the two countries last year. “Signed on Tuesday by Iranian president (Mahmoud Ahmadinejad) it is effective immediately,” Janan Musazai, a foreign ministry spokesperson, told Reuters, adding that Iran is holding around 3000 Afghans in its prisons. It was unclear how many Iranian prisoners are in Afghan prisons, Musazai said. The two neighbours first drew up rules defining the terms of such exchanges in 2006, allowing prisoners or their families to choose whether to be incarcerated in Iran or Afghanistan. The foreign ministry praised the move by Iran as “a strengthening in bilateral relations” - but it said in a statement that the agreement applied only to prisoners who had at least six months to run on their jail terms. As NATO and its foreign partners prepare to end their combat role by the end of 2014, attention is turning towards Afghanistan’s neighbours and what role they could play in helping build the country’s future. Though ties between Afghanistan and Iran have improved since the Taliban was ousted just over a decade ago with Washington even saying Tehran could help stabilise and rebuild Afghanistan, the relationship remains fragile. Kabul said it was “shocked” last year by reports that Iran had executed a large number of Afghan prisoners, most convicted for drug trafficking between the world’s two top users of opium. Economic hardship and insecurity have led many Afghans to cross the country’s 1000km (621 miles) porous border to its west, and Iran is host to more than one million Afghan refugees today. However, some Afghans say they have experienced prejudice at the hands of Iranians, who treat them as second-class citizens. Some are also excluded from qualified work and many resort to the narcotics trade. Traffickers are routinely sentenced to death in Iran, one of the world’s leading executioners.