The assaults aimed to push back a revolt that has moved closer to Gadhafi's bastion in the capital, Tripoli. The uprising has already broken away nearly the eastern half of Libya and unraveled parts of Gadhafi's regime.
In Zawiya, 30 miles west of Tripoli, an army unit attacked the city' Souq Mosque, where regime opponents had been camped for days in a protest calling for Gadhafi's ouster, a witness said. The soldiers opened fire with automatic weapons and hit the mosque's minaret with fire from an anti-aircraft gun, he said. Some of the young men among the protesters, who were inside the mosque and in a nearby lot, had hunting rifles for protection.
The witness said there were casualties, but couldn't provide exact figures. He said a day earlier an envoy from Gadhafi had come to the city and warned the mosque protesters, "Either leave or you will see a massacre." Zawiya is a key city near an oil port and refineries.
"What is happening is horrible. Those who attacked us are not the mercenaries, they are sons of our country," he said, sobbing. After the assault, thousands massed in the city's main Martyrs Square, shouting "leave, leave," in reference to Gadhafi, he said.
"People came to send a clear message: We are not afraid of death or your bullets," he said. "This regime will regret it. History will not forgive them."
The other attack came at a small airport outside Misrata, Libya's third largest city, where rebel residents claimed control Wednesday. Militiamen with rocket-propelled grenades and mortars barraged a line of them who were guarding the airport, some armed with automatic rifles and hunting rifles, said one of the rebels who was involved in the battle.
During the fighting, the airport's defenders seized an anti-aircraft gun used by the militias and turned it against them, he said. He said dead and wounded had been taken to Misrata hospitals but could not give exact figures.
The militias pulled back in the late morning. In Misrata, the local radio - controlled by the opposition like the rest of the city - called on residents to march to the airport to reinforce it, said a woman who lives in downtown Misrata.
In the afternoon, it appeared fighting erupted again, she said, reporting heavy booms from the direction of the airport on the edge of the city, located about 120 miles (200 kilometers) east of Tripoli.
She and other witnesses around Libya spoke on condition of anonymity for fear of reprisals.
Gadhafi's crackdown has so far helped him maintain control of Tripoli, a city that holds about a third of Libya's 6 million population. But the uprising has divided the country and threatened to push it toward civil war: In cities across the east, residents rose up and overwhelmed government buildings and army bases, joined in many cases by local army units that defected. In those cities, tribal leaders, residents and military officers have formed local administrations, passing out weapons looted from the security forces' arsenals.
The leader's cousin, Gadhaf al-Dam, is one of the most high level defections to hit the regime so far, after many ambassadors around the world, the justice minister and the interior minister all sided with the protesters.
Gadhaf al-Dam belonged to Gadhafi's inner circle, officially his liaison with Egypt, but he also served as Gadhafi's envoy to other world leaders and frequently appeared by his side.
In a statement issued in Cairo on Thursday, Gadhaf al-Dam said he had left Libya for Egypt "in protest and to show disagreement" with the crackdown.
Gadhafi's control now has been reduced to the northwest corner around Tripoli, the southwest deserts and parts of the center. The uprisings in Misrata, Zawiya and several small towns between the capital and Tunisian border have further whittled away at that bastion.
The Zawiya resident said that until Thursday's attack, Gadhafi opponents held total sway in the city after police fled days earlier. Residents had organized local watchgroups to protect government buildings and homes.
The capital, Tripoli, saw an outbreak of major protests against Gadhafi's rule earlier this week, met with attacks by militiamen that reportedly left dozens dead.
Pro-Gadhafi militiamen - a mix of Libyans and foreign mercenaries - have clamped down on the city since the Libyan leader went on state TV Tuesday night and called on his supporters to take back the streets. Residents say militiamen roam Tripoli's main avenues, firing the air, while neighborhood watch groups have barricaded side streets trying to keep the fighters out and protesters lay low.
At the same time, regular security forces have launched raids on homes around the city. A resident in the Ben Ashour neighborhood said a number of SUVs full of armed men swept into his district Wednesday night, broke into his neighbor's home and dragged out a family friend as women in the house screamed. He said other similar raids had taken place on Thursday in other districts.
"Now is the time of secret terror and secret arrests. They are going to go home to home and liquidate opponents that way, and impose his (Gadhafi's) control on Tripoli," said the witness.
Another Tripoli resident said armed militiamen had entered a hospital, searching for protesters among the injured. He said a friend's relative being treated there escaped only because doctors hid him.
International momentum has been building for action to punish Gadhafi's regime for the bloodshed.
President Barack Obama said the suffering in Libya "is outrageous and it is unacceptable," and he directed his administration to prepare a full range of options, including possible sanctions that could freeze the assets and ban travel to the U.S. by Libyan officials.
French President Nicolas Sarkozy raised the possibility of the European Union cutting off economic ties.
Italy's Foreign Minister Franco Frattini said estimates of some 1,000 people killed in the violence in Libya were "credible," although he stressed information about casualties was incomplete. The New York-based Human Rights Watch has put the death toll at nearly 300, according to a partial count.
Gadhafi's son Seif al-Islam claimed Thursday that the reported death tolls have been exaggerated, although he didn't provide his own figure. In a press conference aired on state TV, he said the number killed by police and the army had been limited and "talking about hundreds and thousands (killed) is a joke."
He also said a committee had been formed to investigate alleged foreign involvement in the protests.
Earlier Thursday, Libyan TV showed Egyptian passports, CDs and cell phones purportedly belonging to detainees who had allegedly confessed to plotting "terrorist" operations against the Libyan people. Other footage showed a dozen men lying on the ground, with their faces down, blindfolded and handcuffed. Rifles and guns were laid out next to them.
Michael reported from Cairo. Associated Press writers Sarah El Deeb and Bassem Mroue contributed to this report.