Security forces and soldiers who defected to join anti-government demonstrators exchanged heavy gunfire in the streets of this capital city for a third day Tuesday, in confrontations that killed dozens and stoked fears that Yemen could be descending into civil war.

More than seven months after protests began, and three months since President Ali Abdullah Saleh left for neighboring Saudi Arabia after being injured in a bombing, battles broke out on the edge of a camp in Sanaa where thousands of protesters live.

Early Tuesday morning, a rocket attack on the camp and heavy shelling and machine-gun fire elsewhere in the capital killed more protesters. At least two protesters were killed and 10 wounded in the rocket attack, a doctor manning a field hospital at the protest camp told Reuters news agency. Reuters, citing doctors and witnesses, reported that 58 people had been killed in the protests since Sunday.

Defected soldiers and demonstrators were bombarded with shells by government forces and shot at by snipers as violence spread through the city, even as protesters remained peaceful and unarmed, said a spokesman for the 1st Armored Division, a unit led by the defected Maj. Gen. Ali Mohsen al-Ahmar.

“It is a terrible situation, where we are not able to move from our house,” said Hussein al-Awami, a resident of Zubairi Street near the protest camp in central Sanaa. “I have seen dead bodies on the streets.”

A senior U.S. official, who was not authorized to discuss the matter publicly, said Monday that “the events of the weekend, particularly those in Sanaa, are a change in the tone and tenor and level of confrontation from what we have seen in recent months.”

The official said he had concerns that the Yemen-based terrorist group al-Qaeda in the Arabian Peninsula would take advantage of the withdrawal of government forces from certain cities. He added that American diplomats and security officials were working with the Yemeni government, including the president’s eldest son and heir apparent, Ahmed Ali Saleh.

The United States has called upon the elder Saleh to fulfill his pledge to step down and to negotiate a peaceful transition of power with the political opposition. But Saleh has repeatedly reneged on promises to resign, and the country has edged closer to anarchy.

Among the protesters in Sanaa and across the country are large numbers of defected soldiers who have not yet engaged in fighting. But the sudden increase in violence could prompt them to take up arms, analysts said.

“It’s not two equal forces fighting it out to the end, but it could be,” said Robert Burrowes, emeritus professor at the University of Washington. “I think it could very easily develop into something like Libya.”

The fighting over the past three days recalls violence that came to a head this summer with heavy shelling in Sanaa before the June attack on Saleh, whose departure from the country prompted hopes among protesters that a more democratic and less corrupt leadership would be ushered in. But after three months of deepening economic hardship and political stagnation, many despair. “I find it hard to imagine things getting much worse without people just getting totally desperate, prepared to do anything and side with anyone to survive,” Burrowes said.

Salman Shaikh, director of the Brookings Doha Center, urged the United States to play a more proactive role in condemning the violence and work with Saudi Arabia and neighboring countries to avoid a “drift into civil war” in Yemen.

“What has been remarkable is the peaceful nature of the demonstrators. But I am afraid that you will get a situation where people will start fighting back,” he said.

A Yemeni official, who spoke on the condition of anonymity because he was not allowed to discuss the matter publicly, said that government forces had been battling defected soldiers and that civilians had been killed in the crossfire. “The protesters left the camps. They were pumped up. They threw molotov cocktails,” he said.

The months of protests have taken a humanitarian toll on a country in which more than a third of the population did not have enough to eat even before the political crisis began, according to recent reports by Oxfam and the U.N. World Food Program.

In the wake of the crisis, many of the poorest Yemenis have lost their jobs, while the prices of staple foods — rice, oil, sugar and wheat — have increased by an average of 46 percent since the beginning of the year. The price of water also has gone up, and government handouts have been suspended in the chaos.

“How can you have a secure country if people are struggling to have enough food to eat and you can’t afford water?” said Richard Stanforth, a regional policy officer with Oxfam.

The violence struck a blow to hopes that an agreement for a peaceful transfer of power would be signed this week by government and opposition leaders, as U.N. envoy Jamal Benomar and Abdullatif al-Zayani of the Gulf Cooperation Council arrived in Yemen and held talks with political parties amid the fighting.

Although Saleh has been reluctant to cede power under the terms of a deal proposed by the GCC, he passed a decree last week handing the negotiating authority to his deputy, Abed Rabbo Mansour Hadi. International officials hoped this would allow a transition to begin.

Many Yemenis have expressed frustration with the muted international response to the violence. “The international community has let us down,” said Mohammed Rashed, a protester surveying the dead and the injured in a field hospital. “We have been protesting peacefully for several months, and they have not done anything to help us get our freedom.”

Qadhi is a special correspondent. Fordham reported from Washington.