* U.S. confident talks will take place
* Taliban flag at Qatar office taken down
* Exchange of captives expected to be discussed (Adds State Department comment, paragraphs 5-8, 18-19, 27-29)
By Amena Bakr
DOHA, June 20 (Reuters) - A fresh effort to end Afghanistan's 12-year-old war was in limbo on Thursday after a diplomatic spat about the Taliban's new Qatar office delayed preliminary discussions between the United States and the Islamist insurgents.
A meeting between U.S. officials and representatives of the Taliban had been set for Thursday in Qatar but Afghan government anger at the fanfare surrounding the opening of a Taliban office in the Gulf state threw preparations into confusion.
The squabble may set the tone for what could be arduous negotiations to end a conflict that has torn at Afghanistan's stability since the U.S. invasion following the Sept. 11, 2001 al Qaeda attacks on U.S. targets.
Asked when the talks would now take place, a source in Doha said, "There is nothing scheduled that I am aware of."
But the U.S. government said it was confident the U.S.-Taliban talks would soon go forward.
"We anticipate these talks happening in the coming days," said State Department spokesman Jen Psaki, adding that she could not be more specific. James Dobbins, the U.S. special representative for Afghanistan and Pakistan "is packed and ready to go with his passport and suitcase," she said.
One logistical complication is a visit by U.S. Secretary of State John Kerry to Doha on Saturday and Sunday.
Kerry will discuss the Afghan peace talks with the Qatari hosts, senior U.S. officials said, but does not plan to get immersed in any talks himself or meet with Taliban representatives. A major part of his meeting will be devoted to talks on the Syrian civil war.
The opening of the Taliban office was a practical step paving the way for peace talks. But the official-looking protocol surrounding the event raised angry protests in Kabul that the office would develop into a Taliban government-in-exile. A diplomatic scramble ensued to allay the concerns.
Kerry spoke with Afghan President Hamid Karzai on Tuesday and again on Wednesday in an effort to defuse the controversy.
NATO chief Anders Fogh Rasmussen appeared to side with Karzai by pointing out that alliance leaders at NATO's Chicago summit last year had made clear that the peace process in Afghanistan must be "Afghan-led and Afghan-owned".
"Reconciliation is never an easy process in any part of the world," Rasmussen told reporters in Brussels.
A Taliban flag that had been hoisted at the Taliban office in Qatar on Tuesday had been taken down and lay on the ground on Thursday, although it appeared still attached to a flagpole.
A name plate, inscribed "Political Office of the Islamic Emirate of Afghanistan" had been removed from the outside of the building. But a similar plaque fixed onto a wall inside the building was still there on Thursday morning, witnesses said.
Asked whether the Taliban office had created any optimism about peace efforts, the source replied: "Optimism and pessimism are irrelevant. The most important thing is that we now know the Taliban are ready to talk, and sometimes talk is expensive."
Word of the U.S.-Taliban talks had raised hopes that Karzai's government and the Taliban might enter their first-ever direct negotiations on Afghanistan's future, with Washington acting as a broker and Pakistan as a major outside player.
Waging an insurgency to overthrow Karzai's government and oust foreign troops, the Taliban has until now refused talks with Kabul, calling Karzai and his government puppets of the West. But a senior Afghan official said earlier the Taliban was now willing to consider talks with the government.
"It's hard to talk and fight at the same time," said Marc Grossman, Dobbins' predecessor as the U.S. envoy for Afghanistan and Pakistan.
The talks will be "really" difficult, said Grossman, now vice chairman at The Cohen Group consulting firm. He added that he was heartened that the protocol dispute, which he called "the first bump" in the process, was being worked out.
Pakistan's powerful military played a central role in convincing the Taliban to hold talks with Washington, U.S. and Pakistani officials said, a shift from widely held U.S. and Afghan views that it was obstructing peace in the region.
A prisoner swap is seen as likely to happen as the first confidence-building measure between the two sides, said one Pakistani official, who declined to be named.
But he said there were many likely spoilers in the peace process who would want to maintain the status quo to continue to benefit from the war economy and the present chaotic conditions.
"The opening of a Taliban office and the American readiness to hold talks with the Taliban is a forward movement. What happens next depends on the quality of dialogue and political will of the interlocutors," he said.
Pakistan has been particularly critical of Karzai, seeing him as an obstacle to a peace settlement.
In its talks with the U.S. officials, the Taliban was expected to seek the return of former commanders now held at the Guantanamo Bay military prison in Cuba, as well as the departure of all foreign troops.
The United States wants the return of the only known U.S. prisoner of war from the conflict, Sergeant Bowe Bergdahl, who is believed to be held by the Taliban.
Psaki, the State Department spokeswoman, reiterated Washington's desire to free Bergdahl and acknowledged that the Taliban are likely to raise their detainees at Guantanamo early in any talks.
"The exchange of detainees is something the Taliban has raised in the past and we certainly expect they will raise it," she said. "We are open to discussing this issue as part of the negotiations."
U.S. President Barack Obama cannot transfer the Taliban detainees from Guantanamo without a written notification to the U.S. Congress, where some lawmakers vigorously oppose that move.
The Doha protocol dispute burst into the open on Wednesday when Karzai said his government would not join U.S. talks with the Taliban and would halt negotiations with Washington on a post-2014 troop pact.
Officials from Karzai's government, angered by the official-sounding name the Taliban chose for its political office in Doha, said the United States had violated assurances it would not give official status to the insurgents.
A statement on Qatar's foreign ministry website late on Wednesday said that the office was called the "Political Bureau for Afghan Taliban in Doha".
The source familiar with the matter said: "The Taliban have to understand that this office isn't an embassy and they are not representing a country." (Additional reporting by Yara Bayoumy in Dubai, Adrian Croft in Brussels, Lesley Wroughton and Warren Strobel in Washington, and Frank Jack Daniel, Mahreen Zahra-Malik and Matthew Green in Islamabad; Writing by William Maclean; Editing by Philippa Fletcher, Paul Simao and Jim Loney)