Updated

Pakistan assured Britain's visiting prime minister on Sunday that it would promote peace efforts in neighbouring Afghanistan as the West pushes for talks with the Taliban ahead of NATO's withdrawal.

David Cameron's talks in Islamabad were conducted as three attacks in northwest Pakistan killed at least 25 people, underscoring the Islamist militant violence plaguing both sides of the Afghan border.

His two-day visit to Afghanistan and Pakistan was part of a Western push to end a 12-year Taliban insurgency after recent efforts to start peace talks collapsed in ignominy over the manner in which the militants opened an office in Qatar on June 18.

The West considers Pakistani support vital to any peace deal in Afghanistan although relations between Kabul and Islamabad are traditionally mired in distrust.

Apparent headway between Pakistani President Asif Ali Zardari and Afghan leader Hamid Karzai at a summit hosted by Cameron in February has since unravelled in a series of public rows.

"We hope that the UK will continue these efforts to seek sustainable peace and stability in Afghanistan," said new Pakistani Prime Minister Nawaz Sharif after meeting Cameron.

He echoed Karzai's position that any peace process should be "Afghan-owned and Afghan-led". Karzai is hostile to any contacts with the Taliban that sidestep his administration in Kabul.

"I have assured Prime Minister Cameron of our firm resolve to promote the shared objective of a peaceful and stable Afghanistan, to which the three million Afghan refugees currently living in Pakistan can return with honour and dignity," said Sharif.

Cameron said he welcomed Sharif's remarks about the "vital importance of the relationship between Pakistan and Afghanistan".

"I profoundly believe that a stable, prosperous, peaceful, democratic Afghanistan is in Pakistan's interest, just as a strong, stable, peaceful, prosperous and democratic Pakistan is in Afghanistan's interest, and I know that you and President Karzai will work together towards those ends," Cameron said.

The search for a peace deal is an urgent priority as 100,000 US-led NATO combat troops prepare to withdraw next year and Afghan forces take on the fight against insurgents.

The Taliban office in Qatar that opened on June 18 was meant to foster talks but instead enraged Karzai, who saw it as being styled as an embassy for a government-in-exile.

He broke off bilateral security talks with the Americans and threatened to boycott any peace process altogether.

On Saturday, Karzai told Cameron that a subsequent Taliban attack on the presidential palace "will not deter us from seeking peace".

Telephone calls from US President Barack Obama and Secretary of State John Kerry, and a visit to the region by US envoy James Dobbins, appear to have allayed at least some of his initial anger.

Cameron is the first head of government to visit Pakistan since Sharif took office after elections that marked an historic democratic transition in a state long ruled by the army.

He congratulated Sharif on his victory in the May 11 polls and called the transition of democratic power "something of a golden moment for Pakistan and for her people".

Both sides pledged to increase trade between Britain and Pakistan to a target of three billion pounds ($4.56 billion) by 2015.

Sharif has inherited a raft of massive problems, not least a moribund economy and a desperate energy crisis.

He told Cameron his government was taking "austerity measures... to ensure fiscal discipline and address the challenge of energy shortages" and welcomed British development and trade.

On Sunday, a car bomb targeted a Pakistani security forces' convoy in a marketplace near the main northwestern city of Peshawar, killing 17 people and wounding 46 others, mostly civilians.

Two other attacks in the northwest killed a total of eight people.

There was no immediate claim of responsibility for the Peshawar bombing. But the Pakistani Taliban frequently target security forces as part of a seven-year domestic insurgency that has killed thousands of Pakistanis.

Pakistan is on the frontline of the US-led war against Al-Qaeda and terror plots against the West have been hatched in its semi-autonomous tribal belt. Pakistani troops have for years been fighting homegrown militants in the northwest.

Cameron said the battle against terrorism needed "a tough and uncompromising security response" as well as investment in education and tackling poverty.

Sharif said Pakistan was "resolved to tackle the menace of extremism and terrorism with renewed vigour and close cooperation with our friends".

On June 22 gunmen shot dead 10 foreign tourists and a Pakistani guide in an unprecedented attack at a remote base camp in the Himalayas that was claimed by Pakistan's umbrella Taliban faction.