They are from the same village, the same tribe and the same clan. Once as close as brothers, they rose together in Yemen’s military, shared the same political vision, the same lofty desires. One is a conservative Islamist with reputed links to Osama bin Laden. The other is one of America’s closest counterterrorism allies.

For 32 years, Ali Abdullah Saleh and Maj. Gen. Ali Mohsen al-Ahmar have controlled this poor but strategic Middle East nation, the former as its ubiquitous president and the latter as its invisible yet most influential military leader. Now, they are engaged in a highly personal battle to shape the future of Yemen and their own places in history.

“They are like Siamese twins, one body with two heads,” said Hassan Zaid, a top opposition leader. “Now, each head is trying to cut off the other’s head and take control of the whole body.”

Over the past two months, the momentous events in Yemen have echoed those around North Africa and the Middle East: a populist rebellion, fueled by decades of injustice, rising up to demand its leader’s ouster.

But the twist that has emerged in the past two weeks has injected a narrative of Shakespearean proportions, one tightly focused on the two rivals, shrewd men from humble beginnings who grew wealthy and powerful amid allegations of corruption and ruthlessness, and who have now turned on each other.

When snipers loyal to Saleh killed 52 protesters on March 18, Mohsen declared his allegiance to the uprising, triggering a wave of high-level defections from the military, influential tribes and the government. Mohsen, who controls much of the military, was once widely viewed as Yemen’s next leader until Saleh sought to anoint his son Ahmed as his successor. Now, Mohsen has become instrumental in pushing for Saleh’s departure, even as his former partner remains determined to dictate the terms of his exit.

“Ali Mohsen is positioning himself to be involved in a post-Saleh Yemen. He wants to be the kingmaker, the power behind the throne,” said Christopher Boucek, a Yemen analyst with the Carnegie Endowment for International Peace. “For Saleh, his legacy is at stake. How history remembers Saleh depends on how he leaves.”

The questions on many minds here is whether the tensions between Yemen’s two most powerful leaders will lead to a peaceful transition of power or to civil war. They arrive amid troubling signs of government collapse, as soldiers and government officials have abandoned or fled their posts in some provinces.

In the new edition of Inspire, an English-language magazine published online by al-Qaeda’s Yemen branch, radical Yemeni American cleric Anwar al-Aulaqi predicts that the populist upheavals in the Arab world will give birth to weaker governments that will allow al-Qaeda and its affiliates to operate with more freedom. Aulaqi, who is believed to be hiding in southern Yemen, has been implicated in several attempted terrorist attacks targeting the United States.

In the capital, talks between Saleh and opponents led by Mohsen broke down again on Wednesday, after the political opposition rejected a fresh offer by Saleh to transfer power to a caretaker government but remain in office until elections are held. They want Saleh, who has also promised that his son will not succeed him, to step down immediately. “We are telling him, ‘Leave, because you are the problem,’ ” Mohammed Qahtan, a senior opposition leader, said Wednesday.

The rifts between Saleh and Mohsen have split the military, the ruling party and key tribes. Mohsen’s troops are currently deployed in Sanaa protecting the demonstrators while forces loyal to Saleh are also patrolling streets and at checkpoints. Over the past few days, senior U.S. officials have expressed deep concern about the potential for internal confrontation.

Saleh, according to his advisers, was shocked by Mohsen’s defection, although their relationship had frayed years ago over the ascension of the president’s son. “You can tell by the president’s face that he felt sorrow and shame at what Ali Mohsen did,” said Ahmed al-Sufi, a spokesman for Saleh. “Both served together in the military, which instills traditions that no one betrays a comrade. And moreover, they are relatives.”

But others in the ruling party consider Mohsen a hero, viewing his decision to join the protesters as a watershed moment.

“I strongly believe Ali Mohsen has put himself in the right side of history where he has taken the side of the people to see a safe transfer of power,” said Mohammed Abu Lahoum, a senior ruling party official and a respected leader in Yemen’s largest tribal confederation. “The step that Ali Mohsen took should be an encouragement to the president and others. Betting against the people, you will always lose.”

Over the past three decades, at practically every big moment in Yemen, Mohsen backed Saleh. As young soldiers, they were in the same tank regiment. In 1978, Saleh rose to power in what was then North Yemen with the help of Mohsen, whose forces also prevented an attempted coup against Saleh a few months later.

U.S. officials and analysts allege that Mohsen helped recruit jihadists to fight with Bin Laden in Afghanistan during the Soviet occupation. He later allegedly helped Bin Laden resettle Arab jihadists in Yemen.After North and South Yemen unified in 1990, Mohsen was instrumental in the north’s victory in the 1994 civil war, a conflict in which he deployed Arab jihadists to fight on Saleh’s behalf in the south. He is regarded in Yemen as a close ally of neighboring Saudi Arabia, which has long feared that Yemen’s instability could affect its national security.

In a 2005 diplomatic cable released by WikiLeaks last week, Thomas Krajeski, then U.S. ambassador to Yemen, wrote that Mohsen was known to follow an ultraconservative brand of Sunni Islam known as Salafism and “to support a more radical Islamic political agenda than Saleh.”

Although he is officially only commander of Yemen’s northwest region, Mohsen became more powerful than any governor; he is believed to control more than 50 percent of Yemen’s military resources and assets. In stark contrast to Saleh, whose portrait hangs everywhere in the country, Mohsen is secretive. His name, wrote Krajeski, is “mentioned in hushed tones among most Yemenis, and he rarely appears in public. Those that know him say he is charming and gregarious.”

“Ali Mohsen acts as Saleh’s iron fist,” Krajeski added.

But even as he depended on Mohsen’s loyalty, Saleh viewed him as a rival.

According to analysts and diplomats, Saleh never allowed Mohsen to have a public face or interact closely with U.S. and other Western diplomats.

He also sought to weaken Mohsen by keeping him occupied in fighting six wars against northern Houthi rebels in Saada Province over the last decade.

Ahmed Mohamed Ali Othman, a political analyst and opposition figure who knows both men, said he believed that Mohsen had joined the protesters as a last resort “because he knew Saleh wanted to get rid of him.’’

But others say it remains unclear what Mohsen hopes to gain by his defection. Sufi, Saleh’s spokesman, said Mohsen had close ties to Yemen’s Muslim Brotherhood, the political arm of Islah — Yemen’s most organized Islamist opposition party, which many predict could wield great power in a post-Saleh country — and that he may have been acting in its interests.

Many say that Mohsen seized an opportunity to at once exact revenge and distance himself from his former partner.

While opposition leaders have welcomed Mohsen’s decision, many remain wary of his checkered past and alleged corruption. In interviews, many protesters at Change Square, the epicenter of the populist rebellion, said they appreciated Mohsen’s support, but also viewed him as a big part of the current regime, of why they needed a new Yemen.

“We need a civilian government running the country,” said Mosab Qirshee, 23, a student. “We don’t want Ali Mohsen to lead us next.”