Media playback is unsupported on your device Media caption David Cameron described the battle against terrorism as one "we must fight together"

David Cameron has promised to "stand together" with Pakistan in the fight against terrorism.

The British prime minister was speaking after talks in Pakistan with the newly elected prime minister, Nawaz Sharif.

Mr Cameron said the battle against terrorism required an "uncompromising" response, alongside investment in measures to counter extremism.

During the talks Mr Cameron also urged Pakistan to help to create a "stable" and "democratic" Afghanistan.

The British prime minister was on a two-day official visit to Pakistan, where Mr Sharif was recently re-elected for an unprecedented third time.

This came after Mr Cameron visited Afghanistan, where he met troops at Camp Bastion and held talks with Afghan President Hamid Karzai.

Later on Sunday Mr Cameron flew to the city of Atyrau in Kazakhstan for the first ever visit to the country by a British prime minister.

'Both battling terrorism'

Speaking at the Pakistani Prime Minister's official residence, Mr Cameron said both the UK and Pakistan had a shared interest in the "battle against terrorism".

"This is a battle that requires a tough and uncompromising security response," he said.

"But it is also a battle that has to go so much wider.

"Countering extremism and radicalisation, investing in education, tackling poverty, dealing in all the issues that can fuel extremism and radicalisation."

He added: "We will stand together and conduct this fight against extremism and terrorism."

The election of Mr Sharif in May was Pakistan's first democratic transition from one civilian government to another.

Mr Cameron was the first head of government to visit Mr Sharif since he won the election.

He said: "I profoundly believe that a stable, prosperous, peaceful and democratic Afghanistan is in Pakistan's interest, just as a stable, prosperous, peaceful and democratic Pakistan is in Afghanistan's interest."

Image caption The prime minister visited British troops in Afghanistan on Saturday

Mr Cameron told Mr Sharif he knew he and Afghan President Hamid Karzai "will work together towards those ends."

Mr Sharif said he had assured the British prime minister "of our shared resolve to seek a peaceful and stable Afghanistan".

He added: "The Afghanistan peace process should be inclusive, Afghan-owned and Afghan-led".

The two leaders also pledged to increase bilateral trade from £2.5bn to £3bn by 2015.

And Mr Cameron announced plans for the British Council to open a library in Lahore and an office in Karachi to help strengthen cultural ties.

A joint statement said the UK would provide more equipment to tackle improvised explosive devices and "support Pakistan in improving the security of its infrastructure, including sharing the UK's expertise in safeguarding sporting events".

Just after the leaders had finished their joint press conference, a bomb attack in Peshawar, north-west Pakistan, killed at least 14 people.

It was the latest in a spate of attacks which have killed 60 people in the past two weeks.

He also visited the national monument where he met people taking part in the British Council's Active Citizens programme.

Mr Sharif served previous terms as Pakistan prime minister in 1990 to 1993, and 1997 to 1999.

He was deposed by General Musharraf and given a jail term, and later went into exile in Saudi Arabia before returning in 2007.

He won a surprise landslide victory in Pakistan's general elections in May.