President Karzai (r) said the two countries both wanted to eradicate terrorism
|
Pakistan and Afghanistan have agreed a prisoner exchange deal.
It will mean that 400 Pakistanis held in Afghan jails will eventually be released, as will 250 Afghans held in Pakistani jails.
But Afghan President Hamid Karzai said that the detained Pakistanis will only be freed after the authorities were sure they will not harm the country.
The deal was reached in talks in Islamabad between Mr Karzai and Pakistani President Pervez Musharraf.
The BBC's Paul Anderson in Islamabad says Mr Karzai's visit, less than two months before Afghanistan's presidential elections, is being characterised as a success.
He says it gave Mr Karzai and General Musharraf the chance to heal rifts over Afghan allegations that Pakistan is failing to do enough to stop cross-border incursions by Taleban fighters.
'Positive development'
Speaking to reporters after the prisoner exchange deal was struck, President Karzai said the process may take time because some imprisoned Pakistanis have links with the Taleban.
"There are certain people who caused great destruction in Afghanistan," he said, "they have come from Pakistan and caused great loss to us.
"We have to make sure that they do not harm us once they are freed... but eventually all will be freed."
The deal was welcomed by the Pakistani side who called it a "positive development."
It was struck at the end of two days of talks between the two leaders on terrorism and the fight against al-Qaeda remnants and the Taleban.
Another key issue was boosting economic ties.
Correspondents say that trade volumes between the two countries are relatively small.