Updated

US Secretary of State John Kerry began talks with Pakistan's new government on Thursday, likely to be dominated by the fight against Islamist militants as US troops withdraw from Afghanistan.

He arrived late Wednesday at the start of a long-anticipated visit to the nuclear-armed Muslim state, a key but fractious ally in the 12-year US war against Al-Qaeda and the Taliban since 9/11.

He is to hold talks with Prime Minister Nawaz Sharif, who won a convincing victory in May elections, as well as with outgoing President Asif Ali Zardari and army chief General Ashfaq Kayani.

Kerry on Thursday paid tribute to the polls, which marked the first time that an elected civilian Pakistani government completed a full term in office and handed over to another at the ballot box.

"This is a historic transition that just took place. Nobody should diminish it," he told US embassy staff.

"I think President Zardari deserves credit... It is an enormous step forward. It is historic. In the 66 year history of Pakistan that has never happened. So change comes over time," he added.

Pakistani-US relations, deeply troubled in recent years, have 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 the onset of a more stable government under Sharif, with a clear majority, offers a new opportunity to rework relations along realistic objectives.

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

"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 insurgency, the external threat posed by Afghan and foreign militants on its soil, a crumbling economy and an energy crisis.

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.

"Fostering or helping in any way to provide some sort of base for extremism is ultimately not in any of our interests, including in Pakistan's interest," a US official told reporters.

"We'll have to see where the new government is on this and what they're willing to do as how they see it as part of their broader efforts at promoting stability," the official added.

"They are the ones bearing the brunt of continued extremism in Pakistan and that by asserting greater sovereignty over their own country and taking care of these... that is the only way for Sharif to be able to accomplish the goals that he has set out."

Pakistan's nuclear arsenal, which US officials have in the past voiced concern could fall into the hands of Islamist militants, and drone attacks are expected to be part of the discussions.

"The whole purpose of this conversation is to have a very comprehensive, very robust, very serious, very real conversation on the range of our mutual and national security interests," a senior US administration official told reporters.

"It will be hard to imagine that any issue that we think is one of our key national security priorities is not on the agenda."

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 the opening of a Taliban liaison office in the Gulf state of Qatar in June outraged Kabul.

Kabul-Islamabad relations are mired in distrust and while the West has praised Pakistani support for efforts to help a peace deal, 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.