SANAA (Reuters) - Yemeni tribesmen said they wrested a military compound from elite troops loyal to President Ali Abdullah Saleh outside the capital Sanaa on Friday as fighting spread, threatening to tip the country into civil war. Yemeni fighter jets broke the sound barrier as they swooped over Sanaa, where battles between Saleh loyalists and the Hashed tribal alliance led by Sadeq al-Ahmar erupted this week after failure of a deal to ease the president out. Clashes spread northeast of Sanaa on Friday, where tribes said in addition to seizing a military post in the Nahm region, they were also fighting government troops at two other positions south of the capital. In Sanaa, tens of thousands of people gathered after Friday prayers for what they branded a "Friday of Peaceful Revolution" against Saleh, releasing white doves and carrying the coffins of about 30 people killed in clashes this week. Tens of thousands turned out for the rally, inspired by the Egyptian and Tunisian revolutions, though their numbers had dwindled compared to previous weeks after thousands fled Sanaa and the government closed roads around the city to keep out tribes trying to reinforce the Ahmars. Machinegun fire and sporadic blasts rattled the city before fighting eased after mediation efforts. Ahmar's fighters evacuated government ministry buildings they had grabbed this week in return for a ceasefire and troops quitting their area. "We are now in mediation and there has been a ceasefire between the two sides," Ahmar, close to an opposition party, told protesters in "Change Square." "We wanted it (revolution) to be peaceful but Saleh, his sons and his clique wanted war. We will not leave them the opportunity to turn it into a civil war. There is mediation going on now," Ahmar told Reuters. Battles this week, the worst since protests began in January, killed around 115 people and let Saleh grab back the initiative, overshadowing the protest movement with the threat of civil war. Yet protesters were determined to see him go. "We are here to renew our resolve for a peaceful revolution. We reject violence or being dragged into civil war," said Yahya Abdulla at the anti-Saleh protest camp, where armed vehicles were deployed to protect those praying. A few kilometers (miles) away, government loyalists staged a short rally, waving Yemeni flags and pictures of Saleh, who has ruled the Arabian Peninsula state for nearly 33 years. Worries are growing that Yemen, already a safe haven for al Qaeda and on the verge of financial ruin, could become a failed state that would erode regional security and pose a serious risk to neighboring Saudi Arabia, the world's top oil exporter. The United States and Saudi Arabia, both targets of foiled attacks by a wing of al Qaeda based in Yemen, are concerned any spread of anarchy could embolden the militant group. In Nahm, 100 km (60 miles) northeast of Sanaa, a tribal leader said fierce fighting over three military posts killed 19 and wounded dozens. He said tribesmen had seized one post and were battling for two more as military planes bombed the area. "There had been some skirmishes between the tribesmen supporting the youth revolution from time to time, but today it became a big armed confrontation," Sheikh Hamid Asim said. He had earlier said anti-Saleh fighters killed the commander of the military post they seized. A separate tribal source said the Yemeni air force dropped bombs to prevent the tribesmen from seizing an arms cache there.