If all goes as hoped, U.S. and Qatari negotiators will meet soon to nail down final details for transferring Taliban prisoners from Guantanamo prison - a momentous step for President Barack Obama, the Afghan war and perhaps U.S. foreign policy as well.

Should U.S., Afghan and Qatari officials reach agreement, the Obama administration's careful diplomatic choreography then calls for the Afghan Taliban to open an office in Qatar to conduct peace talks with the Western-backed Afghan government.

The Taliban would be expected to make a statement condemning international terrorism.

And at some point - exactly when is unclear - the United States would start sending the first of five senior Taliban members it has held for a decade to Qatar.

On the way to the first-ever peace negotiations to end the long and bloody Afghan war, much could go wrong - indeed much already has. The peace talks have been beset by fits and starts, and U-turns, and there is a good chance that even these initial good-faith measures won't ultimately come off.

But Obama's peace gambit, which he hopes to unveil at a NATO summit in May, has the potential to be a significant development for U.S. foreign policy. For the first time in a generation, diplomats will be seeking to broker a major settlement with an enemy U.S. troops are fighting on the battlefield.

The talks, with the United States playing the role of mediator, offer a hope, however slim, for Afghanistan to decide its own destiny after nearly 40 years of conflict.

Obama's turn to diplomacy was born out of necessity and the realization that the Taliban were not going to go away.

Two years ago the hope at the Pentagon was that we were going to defeat these guys so seriously they would no longer be a military force. No one expects that to happen anymore, said Bruce Riedel, a former CIA and White House official who chaired Obama's 2009 review of Afghan policy.

U.S. officials, in preliminary internal discussions, have also been exploring what structure possible negotiations might take, what demands might be made of the Taliban and what sort of power-sharing scenarios might be considered if a real peace accord can be reached in Afghanistan.

The talks would take place at least in part in Qatar, and might include the senior Taliban prisoners whose transfer from Guantanamo Bay is a key confidence-building measure on the part of the Obama administration.

Facing pushback from lawmakers who fear Taliban detainees will join the insurgency, the Obama administration has stressed it has not yet made a final decision to transfer the prisoners. Officials are already bracing themselves for the torrent of bipartisan attacks sure to come from Capitol Hill if and when they begin the notification process for moving detainees.

TALIBAN'S TRUE INTENTIONS MURKY

While the Afghan peace attempt echoes similar U.S. efforts in the past, U.S. officials dislike the comparison with Vietnam, where the 1973 Paris Peace Accords that were supposed to end the war - but didn't - were seen as a cover for the U.S. departure and abandonment of an ally, South Vietnam.

Today's initiative contrasts with U.S. reluctance in more recent years to engage directly with other adversaries - Iran, the Islamist Palestinian group Hamas, or Lebanon's Hezbollah.

Michael O'Hanlon, an expert on U.S. foreign policy at the Brookings Institution in Washington, said a long period followed the Korean and Vietnam wars in which Washington did less direct engagement with its enemies. That reluctance became more stark after the September 11 attacks, when the George W. Bush administration cast efforts to defend against security threats as a battle between good and evil.

While that period appears to be coming to an end - and the Afghan Taliban, unlike Hamas and Hezbollah, was never designated as a terrorist group - the idea remains controversial.

As a candidate, Obama was widely criticized for suggesting he would meet with leaders of rogue nations like Iran without precondition.

As president, he has shown himself to be determined to wind down the costly wars in Iraq and Afghanistan, where he is moving to withdraw most U.S. combat troops by the end of 2014.

Obama recognizes that wars, and in particular counterinsurgencies, end when enemies talk to each other, said Caroline Wadhams, a security expert with the Center for American Progress, a think tank seen as close to the White House.

Yet critics of Obama's bid for a negotiated settlement contend the push for peace comes far too late, as a decisive troop drawdown plan dilutes remaining U.S. leverage.

READING THE TEA LEAVES

To keep their initiative on track, U.S. officials must grapple not only with hostility in Congress and what they describe as Afghan President Hamid Karzai's erratic stance toward initial U.S. efforts. They must also confront the legacy of unanswered Taliban advances in the past.

Michael Semple, a former U.N. official with over two decades of experience in Afghanistan, said that since the Taliban government was toppled in 2001, the group has approached Afghan and Western officials repeatedly to indicate an interest in surrender, negotiations or re-entry into the political process.

The first meeting took place in early December 2001 just north of Kandahar, the seat of Taliban power, between senior Taliban officials and Karzai, only then emerging as Afghanistan's interim leader.

As a significant political force in Afghanistan's long civil conflict, Semple said, the Taliban leadership expected to be insiders in the process.

That overture fell flat - as did ones by Taliban leaders who endorsed the pursuit of negotiations when they gathered in Pakistan in 2002 and again in 2004.

Western officials, seeing a marginal military threat from the Taliban, expressed little interest. Karzai allies, eager to solidify their own growing political power, discouraged the Americans from accepting Taliban suggestions.

While the Taliban slowly regained its military power over the years, various individuals affiliated with militant leadership approached Afghan or U.S. officials, including Wakil Ahmad Muttawakil, the Taliban's last foreign minister, and Tayeb Agha, a close aide to Taliban leader Mullah Omar who is now the chief interlocutor in U.S. discussions.

Some Taliban representatives were kept waiting. Some ended up in prison. Over time, militants' grew deeply suspicious of Western and Afghan government statements on the talks - a major handicap to the U.S. peace efforts today.

Veteran U.S. diplomat Ronald Neumann, who was U.S. ambassador in Kabul from 2005 to 2007, says he cannot recall a serious discussion with senior Bush administration officials during his tenure in Kabul about initiating peace negotiations.

A harsh judgment is required for the way this was handled, said Semple, a long-time advocate of peace talks who is now a fellow at Harvard University. When people start to add up cost of war in Afghanistan over the last decade, they will ask how on earth the new Afghan leadership and U.S. officials failed to take advantage of these early overtures by the Taliban.

Even a year after peace talks became the centrepiece of U.S. political strategy for the war, the motives of a fundamentalist group whose rule of Afghanistan was known for its brutality and repression remain uncertain.

While the Taliban has long refused to engage with the Karzai government, U.S. officials believe a set of influential Taliban 'pragmatists' is ready to make a deal. Whether they can bring more strident members along is a different question.

The fear of civil war and the fear of losing control are two important motivations for the Taliban to now be engaging, said Alex Strick van Linschoten, a Taliban expert.

Perhaps the biggest obstacle U.S. negotiators face is timing - whether they can establish a sustainable peace process before the bulk of Western forces go home, leaving a highly vulnerable Afghan government standing largely on its own.

Even if the Obama administration manages to get political negotiations going, progress in hammering out a sustainable power-sharing arrangement is likely to be slow at best.

As an Arab friend used to say about another topic: 'You can wait for this sitting down,' Neumann said.

(Additional reporting by Andrew Quinn; Editing by Warren Strobel and Anthony Boadle)