SANAA, Yemen -- 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 on 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 president and thrown their support behind the massive protest movement pushing for the autocratic leader's ouster.

The commanders who abandoned Yemen's embattled president, Ali Abdullah Saleh, accuse him of trying to sow chaos and letting the southern towns fall into the hands of Islamic militants in an effort to persuade the U.S. 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 were also killed, said a local government official who spoke on condition of anonymity because he was not authorized to release the information.

The surrounding Abyan province is one of the strongholds of Al Qaeda in the Arabian Peninsula, which the U.S. considers a more immediate threat than the terror 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 also home to many other Islamist groups.

In Lawdar, the Islamic 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, a local official said army troops were massing at the southern outskirts of the city in preparation for a push to retake the town. Battles there killed 15 soldiers, 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 al-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."

Al-Salahi said the bulk of the militants involved are from groups that allied with Saleh in the past, during the 1994 war with southern separatists. But other elements have joined them recently, including some believed to have Al Qaeda ties, al-Salahi said.

"Things became very mixed up and the Islamic militants are fighting each other, as much as they are fighting the army units," he said.

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

According to a military official close to Gen. Ragab, who is originally from Abyan, the army officers who have abandoned Saleh have made a commitment to fight Islamic militants while holding the president responsible.

He said troops have cornered the militants inside Abyan province and prevented their attempts to push out to other provinces in the south. He spoke on condition of anonymity because he was not authorized to brief journalists.

President Saleh has resisted calls to step down by hundreds of thousands of protesters who have filled the streets of major cities in Yemen since early February, but a deadly crackdown has failed to clear them from the streets.

Pressure from the United States and Yemen's neighboring countries has been building on Saleh to step down as part of a negotiated deal with opposition parties that would preserve some measure of order in the fragile nation.

The crisis descended into armed street battles two weeks ago between the president's forces and gunmen loyal to Yemen's most powerful tribal leader, who has turned against Saleh.

Saleh, who has ruled Yemen for nearly 33 years, was seriously wounded in an attack on the president's compound in the capital a week ago and had to be take to Saudi Arabia for urgent medical treatment.

The U.S., which had relied on Saleh to help fight the militants, is worried Al Qaeda's branch in Yemen will take advantage of the instability. U.S. forces have carried out several recent air attacks on Al Qaeda targets in the country.

While Al Qaeda's estimated 300 hard core members in Yemen may gain more room to maneuver and plot attacks against the West, it is unlikely they could make a serious push to take control of Yemen, as the president claims.