David Cameron, the UK's prime minister, and Asif Ali Zardari, Pakistan's president, have agreed to set aside their recent differences and work towards boosting ties between the two countries.
"Whether it is keeping troops safe in Afghanistan or keeping people safe on the streets of Britain ... we are going to work together in this enhanced strategic partnership," Cameron said on Friday after he met Zardari at his country retreat outside London.
The meeting between Cameron and Zardari came a week after the British prime minister ignited a row by suggesting Islamabad was allowing the Taliban and other armed groups to operate from its territory.
Cameron accused Pakistan of "exporting terror" while looking "both ways".
Tension had been building ahead of Friday's meeting with both leaders refusing to back down.
War of words
But the two appeared to put the dispute behind them as they discussed ways to boost trade and work together to fight "terrorism".
"Storms will come and storms will go and Pakistan and Britain will stand together and face all the difficulties with dignity, and we will make sure the world is a better place for our coming generations," Zardari said.
"Both sides realise that they need to cool the temperature ... because there has been a war of words over the last week or so"
Al Jazeera correspondent
He said the countries' diplomatic relationship would "never break, no matter what happens".
Previously Zardari hit back at the allegations of double-dealing, arguing that Pakistanis are often the victims of attacks on home soil and that Islamabad is committed to fighting armed groups in the region.
Alan Fisher, Al Jazeera's correspondent outside the meeting venue, said both sides needed to get past the dispute to "frame the ongoing relationship" between the two countries.
"Both sides realise that they need to cool the temperature ... because there has been a war of words over the last week or so."
The British leader's criticism had sparked fury in Islamabad, especially as it was made on a visit to India, with which Pakistan has fought three wars since partition in 1947.
The remarks prompted the Pakistani government to summon Britain's ambassador to Islamabad earlier this week for a dressing down.
Zardari came under pressure to cancel his trip over the controversy, but his office insisted that it gives Pakistan a chance to make its case.
Despite standing by his comments, Cameron has accepted that Pakistanis are often the victims of attacks, including the one that killed Zardari's late wife Benazir Bhutto, the former premier assassinated in Pakistan in 2007.
The leaders were also set to discuss the devastating floods in Pakistan which have killed about 1,500 people and affected more than four million.
Zardari's failure to return home immediately in the aftermath of the disaster has drawn criticism from opposition politicians in Pakistan and MPs of Pakistani origin in Britain.