SANAA, Yemen (AP) — Yemeni government forces in the capital opened fire with anti-aircraft guns and automatic weapons on tens of thousands of anti-government protesters demanding the ouster of their longtime ruler. At least 12 demonstrators were killed and dozens wounded, witnesses said.

The attack was the deadliest in months against protesters and came as tensions have been escalating in the long, drawn-out stalemate between the regime and the opposition. The president, Ali Abdullah Saleh, left for Saudi Arabia for treatment after being severely wounded in a June 3 attack on his palace, raising hopes for his swift removal. Instead, he has dug in, refusing to step down.

The protest movement has stepped up demonstrations the past week, angered after Mr. Saleh deputized his vice president to negotiate a power-transfer deal. Many believe the move is just the latest of many delaying tactics.

At the same time, greater numbers of security forces and armed regime supporters also have been turning out in the streets in recent days, raising fears of a new bloody confrontation.

More than 100,000 protesters massed Sunday around the state television building and government offices, witnesses said. When the crowd began to march toward the nearby Presidential Palace, security forces opened fire, they said. Snipers fired down at the crowd from nearby rooftops, and plainclothes Saleh supporters armed with automatic rifles, swords and batons attacked the protesters.

“This peaceful protest was confronted by heavy weapons and anti-aircraft guns,” said Mohammed al-Sabri, an opposition spokesman. He vowed that the intensifying protests “will not stop and will not retreat.”

Dr. Mohammed al-Abahi, a physician at Sanaa field hospital, said that 12 protesters were shot dead and more than 200 were wounded. “Most of the injuries are at the chest, shoulder, head and face,” he said, with 25 of the injured protesters in critical condition.

He accused security forces of preventing ambulances from evacuating the wounded and collecting bodies of the slain protesters.

A Yemeni opposition television network carried live video of men carrying injured protesters on stretchers, including a motionless man whose face was covered with blood and eyes were wrapped with bandages. Other young men were lying on the floor in the chaotic field hospital.

Protesters throwing stones managed to break through security lines and advance to near the Yemeni Republican Palace at the heart of Sanaa, turning the clashes with the security forces into street battles.

The Yemeni state news agency Saba quoted a security official as saying that the Muslim Brotherhood rallied “unlicensed protests” near the University of Sanaa and that “the militia threw firebombs at a power station, setting it on fire.”

Though Mr. Saleh has been in Saudi Arabia since June, he has resisted calls to resign. Last week he deputized his vice president to discuss a Gulf-mediated, U.S.-backed deal under which he would step down in return for immunity from prosecution. Mr. Saleh previously has backed away three times from signing the deal.

The U.S. once saw Mr. Saleh as a key ally in the battle against the dangerous Yemen-based al Qaeda branch, which has taken over parts of southern Yemen under cover of the political turmoil in the country. The U.S. withdrew its support of Mr. Saleh as the protests gained strength.

Demonstrations also took place Sunday in many other Yemeni cities, including Taiz, Saada, Ibb and Damar.

Earlier Sunday, government troops shelled for the third day a district in the capital held for months by a powerful anti-government tribal chief and his armed supporters.

Sheik Sadeq al-Ahmar said his fighters did not return fire after the shelling by the elite Republican Guard. Sheik al-Ahmar said he did not want to give Mr. Saleh any excuse not to sign a deal to transfer power after ruling the impoverished country for 33 years.