The flight of Yemeni leader Ali Abdullah Saleh to Saudi Arabia deprives the United States of a fitful ally in the fight against al-Qaeda’s most dangerous affiliate and injects new uncertainty into counterterrorism operations that were already hampered by the country’s bloody internal strife, according to Yemen and security experts.

While Saudi Arabia, with U.S. backing, will almost certainly prevent Saleh’s return to Yemen, it is unclear who will replace him and whether there will be a change in attitude toward American efforts to target Islamic militants in the country.

The Pentagon and the CIA, which have steadily deployed more men and equipment to Yemen, including armed drones, will have to forge fresh relationships with whatever new leadership emerges in Yemen. And some in the opposition to Saleh have expressed skepticism about even the existence of al-Qaeda in the Arabian Peninsula (AQAP), describing the terrorist group that has come to preoccupy Washington in recent years as a myth.

Officials in the United States and elsewhere fear that the al-Qaeda group will exploit the turmoil in Yemen to solidify its base and launch fresh attacks.

In recent weeks, U.S. officials said, Yemen’s counterterrorism forces, including special forces units that the U.S. has helped fund and train, have been sent back to their barracks or diverted from the pursuit of AQAP militants.

Some observers said that if the violence continues, the chaos might put pressure on the United States to act unilaterally, including expanding the use of armed drones.

Saleh’s departure to seek medical treatment for wounds suffered in an attack triggered celebrations Sunday in Sanaa, the capital, where jubilant residents filled the streets. But there was continued violence in the southern city of Taiz, with Yemeni security forces fighting gunmen.

AQAP emerged in the span of several years as a major terrorism threat by exploiting lawless spaces in Yemen and establishing itself as an innovative and influential al-Qaeda node. More than any other regional affiliate, AQAP has demonstrated a commitment to launching attacks against the United States, using the Internet to reach Western recruits and embracing the idea that even failed attacks can have a profound impact, according to U.S. counterterrorism officials.

The terrorist group was behind the attempt to bring down a commercial flight over Detroit on Christmas Day 2009, as well as the targeting last year of cargo jets heading to the United States.

“We would be shortsighted to think this doesn’t pose short-term national security concerns,” said Frank J. Cilluffo, a former White House official who leads the Homeland Security Policy Institute at George Washington University. “The likelihood is that [AQAP operatives] will be raising their heads.” But he said that could provide an opportunity for the United States to launch strikes against them.

April Alley, the senior Arabian Peninsula analyst at the International Crisis Group, said that with Saleh gone, there is a real opportunity to initiate a peaceful transition to elections but that Yemen remains “quite precarious.”

“If a transition plan is not agreed to immediately, the situation could rapidly deteriorate into more widespread violence,” she said, noting that Saleh’s forces and his tribal enemies are still mobilized. “With Saleh out of the country, his son and nephews are severely weakened, but they still have tremendous destructive capacity.”

Gregory Johnsen, a Yemen expert at Princeton University, said a number of groups that have a shared antipathy toward Saleh, ranging from tribes to young protesters, may struggle to agree on how best to transition to new leadership in the country. He said the United States, as a result, may have to scramble to plan for the loss of its ally.

“The U.S., until very recently, didn’t put much focus on what comes after Saleh,” Johnsen said. “I’m not sure they have a good plan for what comes next — assuming anyone can know what comes next.”

Marine Col. David Lapan, a Pentagon spokesman, said Friday there were no plans to evacuate U.S. military personnel in Yemen who have been stationed there to train Yemeni counterterrorism forces. Lapan declined to say how many U.S. trainers are in Yemen but said they were taking “necessary precautions.”

There were reports in Yemen last week that a drone strike killed several AQAP militants in the coastal town of Zinjibar, even as Saleh’s forces and tribesmen were engaged in street fighting in Sanaa.

The strike could not be confirmed, but about 300 Islamic militants were reported to have taken over Zinjibar in late May.

“Yemen is so much more fractured and complicated than the other countries affected by the Arab Spring,” said Juan Zarate, a counterterrorism adviser to former president George W. Bush. “It is a reflection of all the fractures and fissures within Yemeni society: tribal, military, problems of North and South, extremism and militancy. In some way the Arab Spring is really not what’s at play. What’s at play is the top falling off what is a very fragile and fractured country.”

Christopher Boucek, an analyst with the Carnegie Endowment for International Peace, said that if a new government emerges, it would be likely to find a way to accommodate U.S. interests. Although some in the Yemeni opposition described AQAP as a myth, such rhetoric might be less likely if those who have been operating as outsiders move closer to government.

Faced with the reality of running a bankrupt, fragmenting country, whoever comes to power is going to be desperate for international assistance, Boucek said. And the U.S. can impress upon any new government the need for uninterrupted, and indeed stronger, action against AQAP.

“There are mutual interests,” Boucek said. “My guess is that there is no money left in the bank, that the economic collapse is even worse than we think. The U.S. can help with economic development, resource depletion, all the things that cause instability. And it can say you also need to help us do something about AQAP.”