John Kerry arrives in Pakistan for key talks: AFP

US Secretary of State John Kerry flew to Pakistan late Wednesday to press the new government on eliminating Islamist militant safe-havens as US-led troops prepare to leave Afghanistan.

He arrived in Islamabad shortly before 9pm (1600 GMT) ahead of meetings with President Asif Ali Zardari, Prime Minister Nawaz Sharif and army chief General Ashfaq Kayani on Thursday.

Pakistani-US relations have been deeply troubled in recent years but recovered at least somewhat from the crisis sparked by the US killing of Al-Qaeda mastermind Osama bin Laden in May 2011.

Islamabad demands an end to US drone attacks targeting Al-Qaeda and Taliban operatives and bristles over US insistence that it do more to eradicate the threat posed by Islamist militants.

Pakistan, where anti-American sentiment runs high, complains that the United States fails to appreciate the sacrifices it has made in fighting terror, claiming to have lost 40,000 people since 2001.

But US officials say they are hopeful that Sharif's election and the impending withdrawal of US-led troops from Afghanistan offers a new opportunity to recraft relations along realistic objectives.

"We have obviously seen a pretty tumultuous relationship with Pakistan over the course of the last four and half years," a senior US official told reporters.

"Starting last summer I think we entered into a very constructive period. We really try to have much more sober expectations, to be more realistic," the official added.

Pakistan faces mammoth challenges posed by a domestic Taliban-led insurgency, the presence of foreign militants on its border areas with Afghanistan, a crumbling economy and an energy crisis.

"What we have wanted all along... is a partnership with the people of Pakistan which is really the whole range of issues that are important to us: counter terrorism, Afghanistan, trade and investment, regional stability," a US official told reporters.

"It has never been an easy task but it remains a vital one".

It is the first visit by a US secretary of state to Pakistan since October 2011 when Hillary Clinton urged Islamabad to dismantle havens for Afghan militants and encourage the Taliban into peace talks to end the war in Afghanistan.

Nearly two years later, efforts are in disarray to negotiate an end to the conflict in Afghanistan and last month's opening of a Taliban liaison office in the Gulf state of Qatar outraged Kabul.

Kabul-Islamabad relations are mired in distrust and while the West sees Pakistani support as vital to any deal in Afghanistan, many Afghans consider Pakistan an abettor of the Taliban.

A Pakistani Taliban jail break on Monday, when heavily armed fighters stormed a prison in a northwestern town to free more than 240 inmates underscored the security challenges in Pakistan.

Kerry's arrival has been hotly anticipated in Islamabad, where he visited numerous times as chairman of the Senate Foreign Relations Committee and where he is respected.

As a co-author of a 2009 bill that sought to dispense $7.5 billion in civilian aid over five years, he has been at the vanguard of US efforts to strengthen the civilian administration in Pakistan.

Since winning the May election, Sharif has said he wants to strengthen Pakistan's relations with Washington, but that the United States must take seriously concerns about drone strikes.

He has made economic growth and resolving the energy crisis the top priority of his new administration, but Kerry will be looking to stress that more must be done on militant havens.

"They will only be able to confront their own domestic security issues, they will only be able to provide economic stability and a place for investments, they will only be able to have stable neighbours if they take a greater control over safe havens," said the US official.

"It is a discussion that has had some limited success in some ways but we will continue to make the case quite vocally that it is key priority of the government moving forward".