Yemeni soldiers battled Islamic militants Saturday in an attempt to drive them from several southern towns under the control of hundreds of the fighters. The clashes killed 40 people from both sides, officials said.

In a twist, the army commander leading the campaign to drive back the Islamists is among several top military figures who have turned against the country’s embattled president, Ali Abdullah Saleh, and thrown their support behind the broad protest movement pushing for his ouster.

The commanders who abandoned Saleh accuse him of fomenting chaos and letting the southern towns fall into the hands of Islamic militants in an effort to persuade the United States and other Western powers that without him in charge, al-Qaeda would take control of the country.

Saturday’s fighting around Lawdar and Zinjibar killed 21 al-Qaeda militants, the Defense Ministry said. Nineteen soldiers also were killed, according to a local government official who spoke on the condition of anonymity.

The surrounding Abyan province is one of the strongholds of al-Qaeda in the Arabian Peninsula, which the United States considers a more immediate threat than the network’s central leadership, sheltering along the border between Pakistan and Afghanistan.

It is not clear how closely linked the militants who seized the towns are to Yemen’s al-Qaeda offshoot. The area is home to many Islamist groups.

In Lawdar, the militants attacked a vehicle carrying food supplies for a military camp, killing four soldiers, the local official said. In nearby Zinjibar, which Islamic militants seized at the end of May, 15 soldiers were killed in fighting, the official said.

An adviser to the Abyan governor, Gen. Abdel Hakim al-Salahi, who is a member of the ruling party, accused Saleh of having had “a very clear plot aimed at creating chaos in Yemen.” The plan, according to Salahi, was for the Islamic militants to control at least five southern provinces “in order to spark the fears of the West and terrorize the people of Yemen.”

The fight against them is being led by Gen. Faisal Ragab, a battalion commander who defected to the opposition in March.

Saleh, who has ruled Yemen for nearly 33 years, was seriously wounded in an attack on his compound in the capital, Sanaa, a week ago and taken to Saudi Arabia for medical treatment.

— Associated Press