KABUL - Afghanistan and Iran have agreed to a prisoner exchange, the Foreign Ministry in Kabul said on Thursday, a sign of warming relations between the two neighbors 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 spokesman, told Reuters, adding that Iran is holding around 3,000 Afghans in its prisons.

It was unclear how many Iranian prisoners are in Afghan prisons, Musazai said.

The two neighbors 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.

Please LIKE our Facebook page - it makes us stronger