Media playback is unsupported on your device Media caption Pakistan National Security Advisor Sartaj Aziz says co-operation with Afghanistan is needed

The majority of Afghans are worried about security, a nationwide survey by the Asia Foundation has found.

It says 65% of the Afghans who took part in the survey fear for their safety and that of their families.

Along with security, the country's poor economy, unemployment and corruption are major concerns for Afghans.

It comes as a top Pakistani security official tells the BBC the challenge for both nations is militant and criminal activity on the porous border.

In his recent visit to Pakistan - his first since taking office in September - Afghan President Ashraf Ghani discussed security and the economy.

He held talks with Prime Minister Nawaz Sharif and members of Pakistan's security forces in an attempt to improve economic ties, secure the porous border and tackle terrorism.

None of these are easy tasks given recent acrimonious relations between the two countries. And despite Mr Ghani's sounding a positive note after talks with the Pakistani prime minister there are big stumbling blocks.

The complicated cross-border insurgency is at the top of the list. The two countries have long accused each other of harbouring militants.

Former Afghan president Hamid Karzai, routinely criticised Pakistan for sheltering militant groups. Pakistan has always rejected such complaints and accused Afghanistan of failing to stop cross-border attacks.

Border control

In an interview with the BBC, Sartaj Aziz, Pakistan's national security and foreign affairs adviser to the prime minister, said that neither territory should be used against the other and that both countries needed to co-operate more on border control on the intelligence and operational levels.

Image copyright AFP Image caption Ashraf Ghani (left) met Mr Sartaj when he visited Pakistan at the weekend

"Nobody is suggesting this is an easy task but we have laid out a roadmap and we'll gradually be able to overcome these challenges," Mr Aziz said.

He added that another challenge for cross-border control is criminal activity.

"The entire border has been criminalised," he told the BBC. "There are drug smugglers, timber smugglers - they indulge in a lot of cross-border fighting."

Effective co-operation and dialogue between Kabul and Islamabad could not be more crucial as Nato's US-led force withdraws from the fight against the Taliban.

Pakistan could play a vital role in bringing about peace talks between the Afghan government and the Taliban.

During his visit the Afghan president tweeted that Pakistan's security lay in the security of Afghanistan and vice-versa.

Officials on both sides hoped this visit would provide a fresh start in relations between the two neighbours.

Pakistan says its current military offensive in the tribal region of North Waziristan is evidence of its commitment to destroy militant sanctuaries but for the task to be successful, Pakistan will need its neighbour to co-operate.

Why Pakistan troops are battling militants in Khyber

"[The] North Waziristan operation has achieved one important objective; the sanctuaries and the infrastructure of extremist groups have been eliminated." Sartaj Aziz said.

He added that many militants had been killed but others had managed to escape, some to different parts of Pakistan and others to neighbouring Afghanistan, and that intelligence co-operation between the two countries on tracing them was important. Mr Aziz also said that the blow-back from the operation was not as intense as expected but that some groups could still carry out attacks.

"A suicide bombing only needs one person," he said.

IS threat

Another potential threat for both countries is that of the Islamic State (IS - formerly known as ISIS or ISIL) militants, who have gained substantial chunks of territory in Iraq and Syria.

Earlier this year there were reports of pro-IS pamphlets being distributed in Peshawar as well as slogans supporting the group being seen on the walls.

There have also been recent reports of a meeting in Baluchistan province between delegates of IS and a splinter group from the TTP calling itself Jundullah (the army of God).

Local government officials in Baluchistan downplayed the presence of Islamic State in the province but Sartaj Aziz said the group could be a potential threat.

"I think ISIS is too deeply involved in Iraq and Syria right now, but the potential is there in the sense that for the first time a group that has captured territory and has resources - and so for other extremist groups it is very attractive to work under that umbrella.

"So this is a danger the whole world has to face and if they are weakened within the place they are operating right now then the dangers will become less.

"But God forbid if that doesn't succeed and they become stronger, and if Afghanistan is unable to handle the insurgency within... then the danger will increase."

Mr Aziz added that the threat of IS should not be taken lightly but that it was not a threat right now.

"The immediate worry is to deal with the situation at the border."