Aug 15 (Reuters) - * Rebels say they seize Garyan, encircle Tripoli
* Gaddafi urges people to 'liberate Libya'
* UN envoy in Tunisia where rebels, govt said to hold talks
* Gaddafi security official flies to Cairo
(Adds government spokesman on Garyan in paragraph 7)
By Michael Georgy
ZAWIYAH, Libya, Aug 15 (Reuters) - Libyan rebels said on Monday they had seized a second strategic town near Tripoli within 24 hours, completing the encirclement of the capital in the boldest advances of their six-month-old uprising against Muammar Gaddafi.
In a barely audible telephone call to state television overnight, a defiant and apparently isolated Gaddafi called on his followers to fight rebels he referred to as "rats".
Gaddafi's forces fired mortars and rockets at the coastal town of Zawiyah a day after rebels captured its centre in a thrust that severed the vital coastal highway from Tripoli to the Tunisian border, a potential turning point in the war.
Rebels said they captured the town of Garyan south of Tripoli on Monday. That could not be immediately verified, but if true it would cut off the other main route to the capital.
"Garyan is fully in the hands of the revolutionaries," a rebel spokesman, Abdulrahman, said by telephone.
"Gaddafi has been isolated. He has been cut off from the outside world."
Government spokesman Moussa Ibrahim acknowledged in remarks broadcast on state television that rebel fighters were in Garyan. "There are still armed gangs inside the city. We are able to drive them out," he said.
A U.N. envoy arrived in neighbouring Tunisia, where sources say rebels and representatives of the government have been holed up on the island resort of Djerba for negotiations. The envoy, Abdel Elah al-Khatib, told Reuters he would meet "Libyan personalities residing in Tunisia" to discuss the conflict.
Talks could signal the endgame of a civil war that has drawn in the NATO alliance and emerged as one of the bloodiest confrontations in the wave of unrest sweeping the Arab world.
Rebels may still lack the manpower for an all-out assault on Tripoli, but are hoping their encirclement of the capital will bring down Gaddafi's government or inspire an uprising. In the past, however, they have frequently failed to hold gains, and a fightback by Gaddafi troops could yet break the siege.
Gaddafi's government denies talks with rebels are taking place. His spokesman dismissed reports of negotiations about the Libyan leader's future as part of a "media war" against him.
"The leader is here in Libya, fighting for the freedom of our nation. He will not leave Libya," spokesman Ibrahim said.
A senior Gaddafi security official, Nasser al-Mabrouk Abdullah, arrived in Cairo with nine relatives, telling Egyptian officials he was on holiday. Rebels hoped that would signal more defections from a crumbling government.
After months of only incremental gains in their struggle against Gaddafi, rebel advances in the last two days have transformed the battle, beginning with the capture of the town of Zawiyah which cut Tripoli's main lifeline road west.
Reuters reporters in the town say Gaddafi's forces still hold an oil refinery and have sniper positions on rooftops, but the highway linking Tripoli to the Tunisian border is shut.
Nevertheless, a U.S. military official, speaking on condition of anonymity, told Reuters the advance in Zawiyah could not yet be seen as a "game changer", stressing that the rebels did not have complete control of the town.
At a hospital, medics said six rebels had died and 26 were wounded. They also said firing by Gaddafi forces killed three civilians. One man was shot in the head and a 15-year-old girl died of shrapnel wounds.
A woman lay in the hospital unconscious with shrapnel wounds to her neck. Her brother, who gave his name as Waleed, stood over her holding a drip, his T-shirt drenched in blood. He said Gaddafi's forces were "shooting at us indiscriminately".
Zawiyah's residents have risen up twice in the past, only for their revolts to be crushed by Gaddafi loyalists. But this is the first time rebel fighters advancing from the mountains in the south have reached the town, incorporating it into a front that now cuts off the vital coast road.
Gaddafi's green flag still flew at the coastal highway's border crossing with Tunisia on Monday, but the steady traffic that once supplied Gaddafi-held areas had slowed to a trickle. Passengers said the road was only open for about 70 km (44 miles), a third of the way to Tripoli.
The rebels' reported capture of Garyan would close the capital's other main supply line, a highway south over the mountains and into the desert. That route links Tripoli with Algeria and also can be used to reach the east.
Reuters reporters saw NATO war planes bombing Garyan on Sunday. Abdulrahman, the rebel spokesman, said fighters there had crushed a brigade that formed Gaddafi's main fighting force in the Western mountains, and had seized its weapons.
In the east of the country, rebel advances have been slower. Rebels were able to take journalists on Monday to the deserted oil port of Brega, the frontline for months. Since last week, rebels have held residential parts of the city, while Gaddafi's troops still hold the refinery, oil terminal and port.
Unexploded shells lay on streets, amid burnt-out vehicles and the occasional dead sheep. Rebels said they feared Gaddafi's troops would destroy the oil terminal rather than give it up.
The rebel advances are a relief for NATO allies, especially France and Britain, which have been in the vanguard of a bombing campaign since March that they say will not end until Gaddafi leaves power. NATO ambassadors are due to meet on Aug. 31 to discuss a 90-day extension of their operation in Libya.
A spokesman for British Prime Minister David Cameron, said Britain was aware of reports of rebel progress. "We think the NATO operation is proving successful in eroding Gaddafi's ability to wage war against his own people," the spokesman said.
Libyans fleeing south in their cars reported gunfire in a place called Harsha, between Tripoli and Zawiyah.
"I heard fighting there today on our way here," said one man who declined to give his name. He also said rebels clashed with Gaddafi's security forces inside Tripoli on Sunday night.
"There is no gasoline, no electricity, food prices are up 300 percent. We just cannot live like this anymore," he said.
Gaddafi's overnight speech was delivered over a poor-quality telephone and broadcast by state TV in audio only, giving the impression the leader was in a bunker or other remote hideout.
"Move forward, challenge, pick up your weapons, go to the fight for liberating Libya inch by inch from the traitors and from NATO," the 68-year-old leader said. "The blood of martyrs is fuel for the battle.... The end of colonialism is near. The end of the rats (rebels) is near, as they flee." (Additional reporting by Missy Ryan in Tripoli, Robert Birsel in Brega, Libya, Ulf Laessing in Ras Jdir, Tunisia, Tarek Amara in Tunis, Hamid Ould Ahmed and Christian Lowe in Algiers, Sami Aboudi and Ali Abdelatti in Cairo, Suleiman al-Khalidi in Jordan and Joseph Nasr in Berlin; Writing by Peter Graff; Editing by Alistair Lyon)