SANAA, Yemen — Militants linked to al-Qaida overran a military base in southern Yemen on Thursday in a sophisticated attack that signaled the extremist group’s desire to exploit widening turmoil in this Arabian Peninsula nation.

Six soldiers were killed and three were wounded during the early morning assault on a base housing the 19th Infantry Brigade in the Baihan area in southern Shabwa province, said Col. Adel Ali Hadi, chief of special forces operations in the area.

The attack came three weeks after Houthi rebels effectively deposed Yemen’s U.S.-backed president, Abed Rabbo Mansour Hadi. He had supported a U.S. drone program that targets al-Qaida’s branch in Yemen, known as al-Qaida in the Arabian Peninsula (AQAP).

“They attacked using different kinds of weapons, including suicide bombs, artillery, bazookas and medium-size weapons,” Hadi said.

He added that a military warplane attempted an airstrike on the base after the militants seized it, but that it missed.

In New York, U.N. Secretary-General Ban Ki-moon warned during a briefing with the Security Council that Yemen was descending into chaos.

“Yemen is collapsing before our eyes. We cannot stand by and watch,” he said, adding that the country must be pulled back “from the brink.”

In recent days, the United States and several other countries closed their embassies in the Yemeni capital.

In Washington, a senior U.S. official indicated that the decision to shut the U.S. embassy may have been driven more by concern about the danger posed by AQAP than broader instability in the capital.

In written testimony submitted to the Senate Intelligence Committee, Nicholas Rasmussen, director of the National Counterterrorism Center, cited concern that “AQAP could take advantage of the political chaos in the capital to carry out attacks against our personnel or other Western targets in Sanaa.”