The powerful head of Pakistan's army, General Raheel Sharif, met Afghan President Ashraf Ghani on Sunday, the latest in a series of encounters between officials to prepare the way for new peace talks with the Taliban.

Officials and politicians from Pakistan, Afghanistan and India have met in recent months in what are seen as cautious moves towards easing long-standing tensions between Islamabad, New Delhi and Kabul.

Ghani's office said the talks on Sunday had focused on security, joint efforts to tackle terrorism and the resumption of peace talks with moderate elements of the Taliban after nearly 15 years of war.

"Both sides have agreed to continue the peace process with groups of Taliban that are ready for negotiation and reconciliation and to act against those groups that resort to terrorist actions and violence," his office said in a statement.

The two sides agreed to coordinate counter-terrorism operations and work to prevent the mountainous frontier regions of their respective territories, where government authority is weak, being used as a base for cross-border insurgents.

Sharif's visit to Kabul followed two meetings between Ghani and Pakistani Prime Minister Nawaz Sharif in recent weeks that set the stage for efforts to restart Pakistan-brokered peace talks with the Taliban.

Officials have said talks could begin as soon as next month.

Indian Prime Minister Narendra Modi made a surprise visit last week to the Pakistani city of Lahore on his way back from Afghanistan, where he opened a new Indian-financed parliament building and delivered three Russian-made military helicopters.

General Raheel Sharif, whose influence on Pakistani policy extends well beyond the normal remit of an army commander, was in Washington last month where President Barack Obama and officials pushed hard for a return to talks with the Taliban.

Pakistan is viewed with deep suspicion by many in Afghanistan, who say Islamabad has sponsored the Taliban insurgency with the aim of destabilising its northern neighbour and extending its own influence.

For its part, Pakistan, where many Taliban leaders are believed to be living, denies the accusation and says it is also a victim of militancy. Earlier this month, it marked the first anniversary of an attack on a school in Peshawar in which Taliban gunmen killed 134 students.

Peace talks with the Taliban broke down in July when it emerged that the Taliban's leader Mullah Mohammad Omar had been dead for more than two years and his death had been covered up.

Prospects for more talks have been complicated by the bloody factional fighting within the Islamist insurgent movement in the wake of Omar's death. It has so far said it will not join talks while foreign forces remain in Afghanistan.