BENGHAZI, Libya — Two Islamist militias in the eastern city of Darnah announced Saturday that they were disbanding, bowing to a wave of anti-militia anger that has swept parts of Libya since a deadly attack on a U.S. diplomatic mission on Sept. 11.

A local political activist said that one of the militias, the Abu Salim Brigade, had surrendered several bases in the city. A second militia was also said to have agreed to disband, Reuters reported.

The announcements came a day after tens of thousands of protesters marched in Benghazi demanding the dissolution of militias formed during the revolt last year against Libya’s strongman, Moammar Gadhafi. Protesters stormed four bases in Benghazi, routing a rogue Islamist militia whose members were tied to the attack on the U.S. mission, in which the U.S. ambassador and three other Americans were killed.

They also attacked armed groups nominally under the command of the government, which does not have a well-organized army.

The announcements in Darnah on Saturday, welcomed by residents who had held a sit-in demanding the militias disband, was a reminder of the delicate task facing Libya’s new leaders. As they move against the militias — which have been both a destabilizing force as well as, at times, the sole provider of security — the government faces the possibility of a power vacuum.

After the uprising, the militias, flush with weapons from looted armories or supplied by foreign backers of the revolt, became more powerful than the new government.

Some of the groups were led by hard-line Islamists, including former prisoners in Gadhafi’s jails and veterans of the war in Afghanistan. Some have openly spoken of creating an Islamic state in Libya.

The army chief of staff, Youssef al-Mangoush, begged the protesters Saturday not to attack those militias working under the Defense Ministry. At least four people were killed Saturday during an attack in Benghazi on one of those militias, the Rafallah Sahati Brigade.

Early Sunday, leaders from that brigade joined government officials at a news conference at Benghazi’s airport. The leader of Libya’s national Congress, Mohamed Magarief, said that there would be greater coordination between the government and “security brigades that fall under its umbrella” and that brigades not working with the state would be disbanded.

Other officials, though, suggested that a direct confrontation with any of the militias would be too risky. Saleh Joudeh, a member of Congress, said the problem could not be solved “over one week.”

“You can’t come to these bodies that already exist on the ground and tell them that I want to finish you or that I want to integrate you,” he said. “If we do that we’re fooling ourselves and we’re fooling the people.”

He said the government would seek dialogue with the fringe militias.

“We do not want to repeat Gadhafi’s mistakes by exporting them to other countries to fight,” he said. “They are our sons, and they are our responsibility.”

Others, though, wanted a swift and vigorous effort to end the reign of the militias, especially those led by hard-line Islamists.

“They say they are handling security, but what security do we have?” said Ashour Bentaher, a political activist in Darnah, where residents have struggled to shake the city’s reputation as a hotbed of militancy. “There are assassinations, there are bombings, kidnappings — what security?”

“We do not want to be like Somalia,” he said.

The wave of anger that had been building against the militias peaked with the attack on the U.S. mission in Benghazi on Sept. 11. Libyan officials said that members of the Ansar al-Sharia militia were responsible.

The White House praised the Benghazi protests as a stand against extremism. They showed that Libyans “are not comfortable with the voices of a few extremists and those who advocate and perpetrate violence, to drown out the voices and aspirations of the Libyan people,” said Josh Earnest, a White House spokesman.

Ansar al-Sharia members quit their base Friday as protesters streamed in. On Saturday, at the looted base of the Rafallah Sahati brigade, soldiers wearing national army uniforms stood guard.

Elsewhere in Benghazi on Sunday, there were fresh reminders of the persistent political violence that brought residents to the streets. Six bodies, said to be members of the national army who had been executed with gunshots to the head, were found in a neighborhood that has become a frequent dumping ground for the victims of Benghazi’s many unsolved crimes.