The steady weakening of Yemen’s pro-U.S. government over the past two months has exposed some of the same difficulties Washington faces in its efforts to battle extremist group Islamic State in Syria and Iraq.

The Yemeni government, which had been a bulwark in the fight against the country’s potent al Qaeda offshoot, collapsed in September after Shiite-linked rebels known as Houthis attacked the capital San’a. Since then, Houthi rebels have taken control of towns and cities throughout Yemen and gained political power while the rival al Qaeda in the Arabian Peninsula, or AQAP, mounted some of its deadliest attacks in an effort to thwart the Houthi advance.

The Pentagon’s strategy to counter Islamic State in Syria faces similar problems to those confronted in Yemen.

The U.S. attempted to weaken AQAP by focusing on airstrikes in the absence of a strong local power on the ground to partner with. But with only a remnant of the Yemeni government remaining in power—President Abed Rabbo Mansour Hadi —Washington is now at risk of losing a key counterterrorism partner at a time when it is trying to contain a new threat in the region.

Despite years of training and hundreds of millions of dollars invested, Yemeni troops have failed to develop into an effective fighting force that could fend off the double threat of AQAP and the Houthis.

In contrast, the Houthis, who have said they receive weapons and training from Shiite Iran, managed to bring down the government and then go on to capture more territory in the predominantly Sunni country. Along the way, they succeeded in holding back AQAP advances.

AQAP claimed responsibility for a deadly car bombing that targeted the Iranian ambassador’s residence in San’a on Wednesday. A security guard and five civilians were killed, security officials said. Hossein Niknam, Iran’s new ambassador who is seen as a close ally of the Houthis, was unharmed.

Since September, the Houthis have overrun territory in the northern provinces of Amran, Jawf and Hajjah and the central provinces of Ibb and Dhamar while continuing to control the capital.

Additionally, the rebels took over much of Hodeidah province in the west in October, including the provincial capital, which is an important Red Sea port. U.S. and Yemeni officials have warned in the past that the Houthis have their eye on the Bab el Mendeb port in the same province, a narrow strait through which some 4% of the world’s oil supply passes.

In October, an offensive by the Houthis followed by U.S. airstrikes in November routed AQAP from Rada, a city overrun by AQAP in southern Bayda province in 2012.

The struggles to build up a ground force in Yemen to underpin airstrikes against extremists resonate particularly in Syria, where the U.S. and its allies are struggling to find a local partner. Absent an effective ground force in Syria, the U.S. is relying heavily on airstrikes to rout Islamic State there. That tactic in Yemen had kept AQAP at bay since 2011, but has so far failed to defeat the force.

Since the Houthi takeover in September, AQAP has increased attacks on government installations and the capital, Yemeni officials said.

A senior American official urged taking a longer view with regard to stabilizing Yemen.

“We can help build up a functioning state inside Yemen, but we need to be patient. This is not going to be a short-term project,” the official said. “But unfortunately with the political and economic insecurities, especially over the last months, al Qaeda has been able to mount a bit of a comeback, which is unfortunate.”

A challenge confronting current counterterrorism strategy to fight AQAP in Yemen and Islamic State in Syria is war fatigue after long commitments of U.S. troops and funding to the wars in Iraq and Syria. President Barack Obama campaigned on ending those wars and bringing U.S. troops home. U.S. airstrikes have become a centerpiece of the president’s counterterrorism strategy.

Yemen’s government has received roughly $950 million in U.S. military, economic and humanitarian assistance since 2011. Since late 2011, the U.S. has increased its assistance, providing $346 million for security, up from $288 million from 2009 to 2011, according to the State Department. Another $249 million has been given for political and economic development and $357 million in humanitarian aid. Even with U.S. support, Yemen’s government and its forces were deeply unpopular and long struggled to extend their authority across the country.

By contrast, the U.S. spent $20 billion in Afghanistan in 2010-2011 for military training and equipment on top of many billions more in humanitarian, economic and political aid.

“Without a ground force to partner with, airstrikes will be hamstrung,” said Jordan Perry, a Middle East analyst with research firm Maplecroft. “There are very few moderate actors that Washington could partner with against AQAP in Yemen. There are the Yemeni security forces. Their legitimacy is limited and much of the country is beyond their scope, so they aren’t effective partners.”

In one reflection of the difficulties the U.S. is up against on the Syrian front against Islamic State, Washington has toned down calls for President Bashar al-Assad to resign. Some in the Obama administration wonder privately whether his Shiite-linked regime backed by Iran is the only force capable of defeating Islamic State. American officials say they are disappointed with the fragmentation of the Free Syrian Army, the Western-allied opposition force fighting both Islamic State and the Assad regime.

In Iraq, the U.S. has propped up the Shiite-dominated government in Baghdad with airstrikes against advancing Islamic State forces. But the Sunni militants of Islamic State flourished in western Iraq in part because of the Baghdad government’s weakness and discriminatory policies toward the country’s Sunni Muslims.

“There’s unfortunately a tendency in U.S.—the effects of which we’re seeing in Iraq and Syria—where Americans expect instant gratification,” said the senior U.S. official. “But it doesn’t work that way.”