Afghan President Hamid Karzai has urged Pakistan "to facilitate peace talks" between his country and the Taliban during a visit to Islamabad.
He said the Pakistani government could provide opportunities for talks between the Afghan High Peace Council and the militants.
Pakistan Prime Minister Nawaz Sharif said that he wanted to help regional efforts to stabilise Afghanistan.
Mr Karzai has extended his stay to allow talks with Pakistan to continue.
The BBC's Charles Haviland in Islamabad says that his decision is a surprise development as the president seeks Mr Sharif's help in bringing the Afghan Taliban to the negotiating table.
Officials say that the fact that Mr Karzai's talks in Islamabad will continue on Tuesday - when he will meet Mr Sharif again - indicates that so far they have gone well and that the two sides have something concrete to talk about.
In their public statements after their talks, both Mr Sharif and Mr Karzai mentioned the problem of militant violence - although Mr Karzai focused much more on it.
Lack of security was the main concern for both neighbouring countries, the president said.
Three times in his brief speech Mr Karzai said that a joint fight against militancy was needed and that he pinned "great hopes" on the re-elected Mr Sharif, who came back to power in June.
Afghanistan believes that Taliban safe havens in Pakistan are the main cause of increased violence in the country.
Elements of Pakistan's intelligence service have long been accused of backing the Afghan Taliban and giving them refuge on Pakistani soil - something Islamabad strongly denies.
Mr Karzai said that he wanted the Pakistani government to play a mediating role with the Taliban, with whom Pakistan has a high degree of influence.
Speaking after the talks, he said that the two countries discussed the "joint fight against extremism and reconciliation and peace-building in Afghanistan with the expectation that the government of Pakistan will facilitate and [provide] help... to the peace process".
"We hope that with this on top of our agenda we can move forward in bringing stability and peace to both countries," the president said.
'Peaceful, stable and united'
For his part the Pakistani prime minister said that Pakistan would extend all possible facilities for peace talks between the Afghan government and the Taliban.
"I assured President Karzai that we will continue to extend all possible facilitation to the international community's efforts for the realisation of this noble goal," he said.
"Pakistan will also help reinforce regional efforts in support of [the] stabilisation of Afghanistan."
He said Pakistan wanted a neighbour that was "peaceful, stable and united" and that the peace process had to be "inclusive, Afghan-owned and Afghan-led".
The Taliban refuse to talk with Mr Karzai, dismissing him as a US puppet.
One of Mr Karzai's main demands has been the release of high-profile Taliban prisoners held in Pakistan in the hope that this will help jump-start direct talks with insurgents.
He is particularly eager for Taliban's second-in-command, Mullah Abdul Ghani Baradar who was arrested in Karachi in 2010, to be freed.
Sources have told the BBC that in his case the Afghans would like him to be transferred to Saudi Arabia or the United Arab Emirates.
Mr Karzai's visit came after an attempt to kick start peace talks in the Qatari capital of Doha foundered in June.