The British prime minister urged Pakistan and India to build on recent, tentative steps toward better relations, saying the "time was now ripe" for both nations to put their history of war and mistrust behind them.

David Cameron made the remarks Tuesday in Islamabad where he is on his first trip to Pakistan as leader.

They were some of the first comments by an international leader in support of the recent thawing of ties between the two countries, whose relations are seen as important to long-term stability in Afghanistan once Western forces withdraw.

Building strong ties with Pakistan is a major foreign policy concern for the United Kingdom, given that the 2005 London transit bombings and several other terror plots have been traced to extremists in its one million-strong Pakistani community.

The nation also is part of the U.S.-led coalition fighting the Taliban and al-Qaeda in Pakistan's neighbour, Afghanistan.

On a visit to India last year, Cameron sparked a diplomatic dustup with Pakistan by suggesting it exported terrorism. Cameron declined to answer questions on those remarks.

Instead, he called for the two countries to make a "fresh start" in their relations. He stressed that the U.K. wanted strong ties between India and Pakistan.

In a speech at a university in the capital, Cameron praised a recent meeting between Prime Minister Yousuf Raza Gilani and Indian Prime Minister Manmohan Singh in India, which took place around a cricket World Cup match between the two countries.

Better relations would mean Pakistan could free up its forces to fight the Taliban as well allow it to spend more money on development. The Pakistan army is widely seen as fighting a proxy war in Afghanistan against what it sees as Indian influence there, complicating U.S. efforts there.

Pakistan's security establishment has long ties with militant networks it used as proxies in Afghanistan and Pakistan, and faces frequent suspicion internationally that it is either tolerating some groups or even supporting them.

Those accusations, which set off a defensive reaction in Islamabad, resonate in many Western nations because of the aid they are giving to Pakistan to prop up its economy.