By Erika Solomon and Mohammed Ghobari
SANAA (Reuters) - After months of protests, bloodshed and diplomacy, Yemen is mired in a contest between the president and his rivals that risks tipping a dirt-poor nation bordering oil giant Saudi Arabia into civil war and economic collapse.
President Ali Abdullah Saleh's struggle against an army general and tribal chiefs who were once powerful allies has almost eclipsed popular demonstrations against his 33-year rule that had chimed with pro-democracy Arab uprisings elsewhere.
Such protests swiftly removed autocrats in Tunisia and Egypt this year, but it took a prolonged and bloody struggle to oust Libya's Muammar Gaddafi. Popular revolts in Syria and Yemen have also turned violent, with the outcome still in doubt.
Political strife has further loosened state control over much of Yemen, allowing free rein to northern rebels, southern secessionists and al Qaeda militants, even as drastic shortages of food, water, fuel and jobs stalk its 24 million people.
Yemenis are wearied by bouts of fighting between Saleh loyalists and opposition forces that have punctuated diplomatic efforts to induce the veteran president to relinquish power.
"We keep thinking we're close to an agreement and then it slips away again," said one senior Western diplomat. "There are very powerful forces at work that don't want an agreement because of their own financial interests, their own skins."
Even within Saleh's ruling party, patience is wearing thin.
"If we want to survive as a party in the future, it's in our interest to sign a political solution as quickly as possible," said one party elder who had once encouraged Saleh to stay on.
Well-connected businessmen have also lobbied politicians to sign a deal, saying responsibility for Yemen's economic nightmare will fall squarely on the GPC if no deal is signed.
Such arguments seem wasted on the president, locked in a triangular struggle with his former allies -- the Ahmar family, which leads a confederation of Yemen's well-armed tribes, and a rebel general and Saleh kinsman, Ali Mohsen.
The Ahmars and Mohsen defected separately earlier this year, but have little in common with the youthful protesters staging daily anti-Saleh demonstrations for the past eight months.
Saleh, Mohsen and the Ahmars each hint they will stand down if their opponents do likewise, yet violent brinkmanship still goes on, turning Sanaa, the capital, into a patchwork of districts controlled by government and opposition forces.
"On some level they want a military conflict because they think they can come out on top. Then they think again, they are not sure, so we end up in this standoff," one negotiator said.
Foreign powers fear the turmoil in this fractured Arabian Peninsula state is emboldening al Qaeda's Yemen-based wing, despite the killing of its chief English-language propagandist, Anwar al-Awlaki, in a U.S. drone strike last week.
Violence has displaced hundreds of thousands of Yemenis, worsening a crisis that could spill into Saudi Arabia and other Gulf countries trying to ease Saleh out with a transition plan.
All parties share the blame for holding up the deal, but analysts say Saleh and his family are the prime obstacles.
Saleh returned to Sanaa last month from Saudi Arabia, where he had spent three months recuperating from an assassination attempt in which he was badly burned. Many interpret his surprise return as a sign that he and his relatives, who control much of the military, will fight to hang on to power.
"It all comes down to one guy who doesn't really want to give up power," one Western negotiator said.
"His family is worried about their own future, their lives. They don't know a Yemen where they're not in control... That kind of Yemen is very scary to them. So they oppose any deal."
On the surface, the argument is over the mechanism for a power transfer. The opposition refuses to join a transitional government until Saleh's powers devolve officially or at least in practice on his vice president. Saleh's party insists he should only hand over his powers after an early election.
Some analysts say Western powers are effectively encouraging Saleh to hang on -- even though Washington pointedly renewed its call for him to quit, just hours after Awlaki's killing.
Gulf specialist Gerd Nonneman, at Georgetown University in Qatar, said Western counterterrorism cooperation with the forces run by Saleh's son and nephew must be stopped.
"It's all very well for the U.S. to occasionally come out with a statement saying it hopes Saleh signs the deal and resigns. But then the family looks at all the collaboration with his son and nephew," he said. "They think, hang on, why don't we tough this out? We're not really going to be pushed out."
Western diplomats have refused to visit Saleh since his return, focusing only on Vice President Abd-Rabbu Mansour Hadi.
They are seeking to whittle away Saleh's objections to the transition deal. "Whether he runs out of arguments first or we run out of options first -- we'll see," said one diplomat.
While negotiators labor in secret, tribesmen and soldiers dig trenches in the battle-scarred streets of Sanaa, where trucks mounted with missiles and machineguns stand on corners.
Many Yemenis are fed up as they see the pro-democracy movement overshadowed by a struggle within the military and tribal elite. Its protagonists, the Ahmars, Mohsen and the Salehs, all belong to the Hashed tribal confederation.
It is not impossible that they could one day realign -- Mohsen's rebel soldiers are still paid by the state.
"This isn't about regular Yemenis, it's a new version of a long fight between the same guys. We're just the ones who get killed," said Maher, 30, a jobless lawyer driving a taxi.
Some negotiators believe differences over a transition deal are so narrow that success is only days away, given the political will, but many Yemenis care little for the debate.
"From my window, I see fighters less than 300 meters from each other," said analyst Ali Seif Hassan. "The closer the politicians come to a deal, the closer the fighters get to (clashing with) each other. We'll see who makes it first."
(Editing by Reed Stevenson and Alistair Lyon)