(Adds quote about Pakistan election)
By Arshad Mohammed
KABUL, March 25 (Reuters) - U.S. Secretary of State John Kerry paid an unannounced visit to Afghanistan on Monday for talks with President Hamid Karzai, a U.S. official said, with both sides hoping to stabilise the country before most foreign troops leave by the end of 2014.
Kerry and Karzai will discuss a host of issues including Afghan reconciliation, the transfer of security responsibility to Afghan forces and Afghanistan's elections, the U.S. official told reporters.
Karzai's government is trying to open formal negotiations with the Taliban, who have remained resilient in the face of superior NATO firepower in the war now in its 12th year.
Karzai is due to travel to Qatar within days to discuss the peace process and the opening of a (Taliban) office for conducting negotiations. The trip comes after years of stalled discussions with the United States, Pakistan and the Taliban.
Commenting on Karzai's trip, the U.S. official told reporters: "I wouldn't want to overplay it but I think that it's a very positive sign. It's another step on a continued path toward... getting to some sort of reconciliation process.
"Nobody is expecting that he will open an office there in a week. Nobody is expecting that he will be sitting down with Taliban in a week. This is a long process and this is one more small but positive step in that ... process."
Tensions between the United States and Afghanistan have heightened in recent years over a range of issues, including civilian casualties during air strikes, night raids and the transfer of prisoners.
The official acknowledged the difficulties in the U.S.-Afghan relationship but said he believed they had resolved a number of them, including an agreement to remove U.S. forces from part of Wardak province where they were accused of mistreating local residents.
He also said the United States believed that the two nations had moved beyond an incident in which Karzai recently accused Washington of colluding with the Taliban to keep foreign forces in Afghanistan, marring U.S. Defense Secretary Chuck Hagel's first trip to Pakistan since taking on his new post.
"There will always be bumps in the road... It's a relationship that can withstand those," the U.S. official said.
"The process of winding down our current position and role in Afghanistan and stepping into more of a support role ... is not going to be a smooth process at all times. Issues of sovereignty and security are always going to be difficult."
The official said Kerry had wanted to visit Pakistan on this trip but had decided not to given the May 11 election, in part to avoid any appearance of seeking to influence what would be Pakistan's first civilian-to-civilian electoral handover.
"We wanted to be, you know, holier than the Pope on this one, on staying away while the electoral process unfolded," said the U.S. official.
"We did not want to lead anyone to conclude anything about where our interests may lie."
The military has ruled Pakistan for more than half of its 66-year history, either through coups or from behind the scenes. (Editing by Nick Macfie and Toby Chopra)