* U.S. official says talks to start on Thursday in Doha
* Peace process will not be easy or quick; could take years
* Obama anticipates "a lot of bumps in the road"
* Afghans say Taliban has agreed to meet government (Recasts lead, adds U.S. deaths in paragraph 5, details and quotes)
By Mark Felsenthal, Warren Strobel and Hamid Shalizi
WASHINGTON/KABUL, June 18 (Reuters) - The United States and the Taliban raised hopes on Tuesday for a negotiated peace in Afghanistan with commitments to meet this week after 12 years of bloody and costly war between American-led forces and the insurgents.
The Taliban opened an office in Doha, the Qatari capital, on Tuesday to help restart talks and said it wanted a political solution that would bring about a just government and end foreign occupation of Afghanistan.
U.S. officials said the talks would start in Doha on Thursday but cautioned that the on-again, off-again peace process would likely be messy and has no guarantee of success.
"It's going to be a long, hard process if indeed it advances significantly at all," a senior U.S. official said.
President Barack Obama said U.S. combat operations would not cease and, in a reminder that the insurgents continue to fight, four U.S. troops were killed in an attack on Bagram Air Force Base in Afghanistan, a U.S. official said later on Tuesday.
The ultimate goal of the diplomatic maneuvering is to get representatives of Afghan President Hamid Karzai's government and the Taliban into direct negotiations on the country's future. The Taliban have thus far refused such talks, calling Karzai and his government puppets of the West.
Nonetheless, the diplomatic announcements represented the first signs of optimism in Afghan peace efforts for many months, and come as the U.S.-led war effort reaches a critical juncture. The NATO command in Kabul on Tuesday completed handing over lead security responsibility to Afghan government forces across the country.
NATO plans to end all combat operations in Afghanistan by December 2014.
Obama, travelling in Europe, cautioned against expectations of quick progress, saying the peace process would not be easy or quick.
"This is an important first step towards reconciliation; although it's a very early step," Obama said after a G8 meeting in Enniskillen, Northern Ireland. "We anticipate there will be a lot of bumps in the road."
It was not immediately clear why the Taliban had agreed to resume talks with the United States, which they broke off in March 2012. The question of entering negotiations has caused rifts between Pakistan-based Taliban senior leaders and younger battlefield commanders, who oppose the move, U.S. officials have said.
In opening the Qatar office, the Taliban said it sought a political solution, but said no dates had been agreed for talks. Taliban representative Mohammed Naeem told a news briefing the group wanted good relations with "all of the world countries."
"But the Islamic emirate (Taliban) sees the independence of the nation from the current occupation as a national and religious obligation," he said.
A senior Afghan official said the Taliban was now willing to consider peace talks with the government, having held secret discussions with government representatives.
U.S. officials said that in the talks in Doha, the United States would stick to its insistence that the Taliban break ties with al Qaeda, end violence, and accept the Afghan constitution, including protection for women and minorities.
The Taliban is expected to demand the return of former senior commanders now detained at the U.S. military prison at Guantanamo Bay in Cuba - a move many in the U.S. Congress oppose - as well as the departure of all foreign troops.
But the United States hopes to keep a force, of as yet undetermined size, in the country after the end of the NATO combat mission.
The peace negotiations also face skeptics in the U.S. Congress.
"Despite the remarkable progress made by the U.S. military over the last 12 years, the Taliban have regained their strength and remain unwilling to make any real commitment to cease hostilities," Senator Saxby Chambliss, a Georgia Republican, said in a statement.
"Until the Taliban confirm, not just in words but in action, that they have renounced all terrorist activity and support, we should not reward them by participating in any reconciliation efforts," he said.
'PEACE IS NOT AT HAND'
U.S. officials said the initial meeting with the Taliban was expected to involve an exchange of agendas, followed by another meeting a week or two later to discuss next steps.
A U.S. official said he expected the initial meeting would be followed within days by another between the Taliban and the High Peace Council, a structure set up by Karzai to represent Afghanistan in such talks.
The U.S. officials, who spoke on condition of anonymity, said the level of trust between the Afghan government and the Taliban remained low, and played down expectations that the talks would quickly lead to peace.
"We need to be realistic," said one official. "This is a new development, a potentially significant development. But peace is not at hand."
The peace talks have struggled to achieve results since then-Secretary of State Hillary Clinton unveiled the diplomatic strategy in February 2011.
That year, U.S. officials discussed a deal that would include an exchange of five Taliban prisoners at Guantanamo for Sergeant Bowe Bergdahl, the only known U.S. prisoner of war in Afghanistan. He has been held since June 2009, and U.S. officials said they would continue pressing for his release.
But the talks never progressed, and the Taliban suspended them in March 2012, saying Washington was giving mixed signals.
Karzai, speaking on Tuesday as the U.S.-led NATO coalition launched a final phase of transferring responsibility for security to Afghan forces, said his government would send a team to Qatar. But he said the talks should quickly be moved to Afghanistan.
"We hope that our brothers the Taliban also understand that the process will move to our country soon," he said.
U.S. officials said the goal was to ensure that Afghanistan did not remain a haven for terrorist groups and to defeat al Qaeda, which was given sanctuary by the Taliban in Afghanistan.
"One of the things we will want to talk about from the very beginning is how they're going to cut ties with al Qaeda," a U.S. official said. "How quickly, exactly how they're going to do it, how quickly."
A senior U.S. official said Pakistan, which has provided sanctuary to the Taliban despite its professed support for the battle against Islamist militancy, had recently been supportive of the peace process.
"There has in the past been skepticism about their support, but in recent months I think we've seen evidence that there is genuine support and that they've employed their influence such as it is to encourage the Taliban to engage," he said.
A U.S. official said the talks would be conducted on the Taliban side by its political commission, with the authorization of its inspirational leader, Mullah Omar. The main U.S. interlocutor has been Tayeb Agha, whom Washington considers close to Omar.
James Dobbins, the new special representative for Afghanistan and Pakistan, will lead the U.S. side.
Also represented will be the Haqqani network, considered the United States' deadliest foe in Afghanistan. The top U.S. and NATO commander in the country cast doubt on Tuesday over whether it could make peace.
"All I've seen of the Haqqani would make it hard for me to believe they were reconcilable," U.S. General Joseph Dunford told reporters by phone from Kabul. (Additional reporting by Dylan Welch and Mirwais Harooni in Kabul, Saud Mehsud in Dera Ismail Khan, William Maclean, Amena Bakr and Yara Bayoumy in Dubai, Jeff Mason in Enniskillen and Phil Stewart in Washington; Writing by David Brunnstrom and Warren Strobel; Editing by David Storey and Jim Loney)