BREGA, Libya - Rebel forces routed troops loyal to Moammar Gadhafi in a fierce battle over an oil port Wednesday, scrambling over the dunes of a Mediterranean beach through shelling and an airstrike to corner their attackers. While they thwarted the regime's first counteroffensive in eastern Libya, opposition leaders still pleaded for outside airstrikes against pro-government troops.

The attack on strategic Brega, 460 miles (740 kilometers) east of Gadhafi's stronghold in Tripoli, illustrated the deep difficulties the Libyan leader's armed forces -- an array of militiamen, mercenaries and military units -- have had in rolling back the uprising that has swept over the entire eastern half of Libya since Feb. 15.

In the capital of Tripoli, Gadhafi warned against U.S. or other Western intervention, vowing to turn Libya into "another Vietnam," and saying any foreign troops coming into his country "will be entering hell and they will drown in blood."

At least 10 anti-Gadhafi fighters were killed and 18 wounded in the battle for Brega, Libya's second- largest petroleum facility, which the opposition has held since last week. Citizen militias flowed in from a nearby city and from the opposition stronghold of Benghazi hours away to reinforce the defense, finally repelling the regime loyalists.

The attack began just after dawn, when several hundred pro-Gadhafi forces in 50 trucks and SUVs mounted with machine guns descended on the port, driving out a small opposition contingent and seizing control of the oil facilities, port and airstrip. But by afternoon, they had lost it all and had retreated to a university campus 5 miles (7 kilometers) away.

There, opposition fighters besieged them, clambering from the beach up a hill to the campus as mortars and heavy machine gun fire blasted around them, according to an Associated Press reporter at the scene. They took cover behind grassy dunes, firing back with assault rifles, machine guns and grenade launchers. At one point, a warplane struck in the dunes to try to disperse them, but it caused no casualties and the siege continued.

"The dogs have fled," one middle-aged fighter shouted, waving his Kalashnikov over his head in victory after Gadhafi's forces withdrew from the town before dusk. Car horns honked and people fired assault rifles in the air in celebration.

For the past week, pro-Gadhafi forces have been focusing on the west, securing Tripoli and trying to take back nearby rebel-held cities. But the regime has seemed to struggle to bring an overwhelming force to bear against cities largely defended by local residents using weapons looted from storehouses and backed by allied army units.

Pro-Gadhafi forces succeeded over the weekend in retaking two small towns. But the major western rebel-held cities of Zawiya and Misrata, near Tripoli, have repelled repeated, major attacks -- including new forays against Zawiya on Wednesday.

In a speech to chanting and clapping supporters in Tripoli, Gadhafi vowed to fight on "until the last man and woman. We will defend Libya from the north to the south."

He lashed out against Europe and the United States for their pressure on him to step down, warning that "thousands of Libyans will die" if U.S. and NATO forces intervene in the conflict.

"We will distribute arms to 2 or 3 millions and we will turn Libya into another Vietnam," he said.

In Benghazi, Libya's second-largest city and the stronghold of the rebellion in the east, a self-declared "interim government council" formed by the opposition called on foreign nations to carry out airstrikes on non-Libyan African mercenaries that Gadhafi has used in his militias to put down the uprising.

Council spokesman Abdel-Hafiz Hoga said the council urged airstrikes on the "strongholds of the mercenaries .... used against civilians and people."

The council was announced Wednesday by opposition leaders, headed by Gadhafi's former Justice Minister Mustafa Abdel-Jalil, who joined the uprising.

The United States is moving naval and air forces closer to Libyan shores and has called for Gadhafi to give up power immediately.

But the Pentagon tried to rein in talk about military options in Libya, including a "no-fly zone" that Defense Secretary Robert Gates said would first require attacking Gadhafi's government.

"Let's just call a spade a spade: A no-fly zone begins with an attack on Libya to destroy the air defenses," Gates told lawmakers. He added that the operation would require more warplanes than are on a single U.S. aircraft carrier.

Pro-Gadhafi militiamen launched a wave of raids in Tripoli to snatch people who participated in anti-government protests in the past week after identifying them in photos and video, several witnesses said.

Dozens were arrested from their homes in dawn raids in the restive neighborhood of Tajoura, said one resident, whose two brothers were among those taken.

"Seventeen cars with armed militia in uniform, they stormed the houses of my brothers. They blew the locks off the doors, they took the jewelry of my sister-in-law, money and my brothers," the resident said, speaking on condition of anonymity for fear of retaliation. "My sister-in-law is pregnant in her sixth month, now she is at the hospital after bleeding."

The attack on Brega was the first major action by Gadhafi forces against the long swath of eastern Libya that is in opposition hands, extending from the oil port all the way to the Egyptian border, nearly half the country's 1,000-mile (1,600-kilometer) Mediterranean coast. Opposition members said they believe the regime pulled up reinforcements from Sebha -- a key Gadhafi stronghold deep in the country's southwestern deserts -- flying them to Sirte, his main remaining bastion in central Libya, to carry out the attack.

The force struck around 6 a.m., catching the small opposition contingent in Brega by surprise and forcing them to flee, said Ahmed Dawas, an anti-Gadhafi fighter at a checkpoint outside the port.

Gadhafi's fighters seized the port, airstrip and the oil facilities where about 4,000 people work, as warplanes hit an ammunition depot on the outskirts of the nearby rebel-held city of Ajdabiya, witnesses said.

The opposition counterattacked at midmorning. Anti-Gadhafi fighters with automatic weapons sped out of Ajdabiya in pickup trucks, heading for Brega, 40 miles away (70 kilometers) away. Dawas said they retook the oil facilities and airstrip. Other witnesses reported regime forces were surrounded by rebels. The sound of screaming warplanes and the crackle of heavy gunfire could be heard as the witnesses spoke to the AP by phone. Several of the pro-Gadhafi force's machine gun-mounted pickup trucks were seen on fire on roadsides in the town.

As the regime troops fled to the university campus in the afternoon, more opposition fighters rode in from Ajdabiya and from Benghazi, 90 miles (150 kilometers) away.

They worked their way up the dune-covered hill from the beach toward the campus. Machine gun and automatic weapons fire rattled in the air. Shells lobbed from the campus splashed in the Mediterranean, while others exploded in the dunes. The anti-Gadhafi fighters brought in a tank from an allied army unit for the assault.

At least 10 opposition fighters were killed and 18 others wounded, their bodies covered with sand from shells bursting in the dunes, doctors at Brega hospital said. Angry crowds gathered around them at the hospital, chanting, "The blood of martyrs will not go in vain."

"We are not prepared for this situation," said Dr. Nasser al-Sobhi, who came from Benghazi to help. "There are no qualified nurses. There are no qualified doctors. There is no equipment for this at the hospital. Everything is a disaster."

In the late afternoon, the pro-Gadhafi force fled the campus, and opposition fighters were seen combing through the university buildings.

Brega is the second-largest hydrocarbon complex in OPEC-member Libya. Amid the turmoil, exports from its ports have all but stopped with no ships coming to load up with crude and natural gas. Crude production in the southeastern oil fields that feed into the facility has been scaled back because storage facilities at Brega were filling up. General Manager Fathi Eissa said last week the facility has had to scale back production dramatically from 90,000 barrels of crude a day to just 11,000.

The unrest in Libya -- which ranks about 17th among world oil producers and has Africa's largest proven oil reserves -- has sparked a major spike in world oil prices. Overall crude production has dropped from 1.6 million barrels per day to 850,000.

The turmoil has also sparked a massive exodus of 180,000 people -- mostly foreign workers in Libya -- who have fled to the borders, U.N. refugee agency spokeswoman Melissa Fleming told the AP. European nations and Egypt launched emergency airlifts and sent ships to handle the chaotic crush.

More than 77,000 so far have crossed in Egypt, and a similar number into Tunisia -- with about 30,000 more waiting at that western border.

Some Somali and Eritreans workers around Benghazi are feeling "hunted" as they are being mistaken for mercenaries hired by Gadhafi, she said, while regime forces appear to be targeting Egyptians and Tunisians, apparently believing they triggered the uprising.

"(There are) many, many terrified refugees" in Tripoli who are too afraid to move for fear they will be killed, Fleming told AP.

In his speech, Gadhafi lashed out against the freezing of his and other Libyan assets abroad and efforts by Europe to send aid to opposition-held Benghazi. In a pointed message to Europe, he warned, "There will be no stability in the Mediterranean if there is no stability in Libya."

"Africans will march to Europe without anyone to stop them. The Mediterranean will become a center for piracy like Somalia," he said. Gadhafi's regime has worked closely with Italy and other European countries to stop African migrants who use Libya as a launching point to slip into Europe.

Gadhafi also repeated his claims that al-Qaida is behind the uprising.

As he spoke, opposition protesters rallied in Benghazi, many of them holding signs saying, "Newsbreak: Gadhafi lies."