By Khaled Yacoub Oweis and Erika Solomon
AMMAN/BEIRUT, July 19 (Reuters) - Rebels battled deep into Damascus and seized control of parts of Syria's borders on Thursday, pressing on with their advance after the assassination of Bashar al-Assad's top security officials brought their 16-month uprising to a head.
Government forces unleashed helicopter gunships and artillery against their own capital. Damascus residents told of buildings in flames and corpses in the streets.
Diplomatic efforts - clearly overtaken by events on the ground - collapsed in disarray when Russia and China vetoed a U.N. Security Council resolution that would have imposed sanctions on Syrian authorities unless they stop using heavy weapons. Washington said the Council had "failed utterly".
The next few days will be critical in determining whether Assad's government can recover from the blow of Wednesday's bombing, which wiped out much of Assad's command structure and wrecked his inner circle's aura of invulnerability.
The attack on a crisis meeting inside a security headquarters killed Assad's powerful brother-in-law, his defence minister and a top general. The head of intelligence and the interior minister were wounded and their condition is not clear.
Assad's own failure to appear in public for more than 24 hours - he was finally shown on television on Thursday afternoon swearing in a replacement for his slain defence minister - added to the sense of his power evaporating.
Rebels claimed control of the main border crossing with Iraq on the Baghdad-Damascus highway at Abu Kamal - one of the most important trade routes in the Middle East - and at least two crossings with Turkey, at Jarablus and Bab al-Hawa.
Lorries were queued up at Bab al-Hawa, a major commercial crossing, shut while battles raged nearby. Footage which rebels said was filmed at the checkpoint showed them climbing onto rooftops and tearing up a poster of Assad.
"The crossing is under our control. They withdrew their armoured vehicles," said a rebel fighter who would only be identified as Ali, being treated for wounds on the Turkish side.
Damascus residents said a heavy onslaught of security force shelling and firing from helicopters went on through the night and continued on Thursday. Some reported explosions in the capital's troubled northeastern and southern districts.
A woman who visited the neighbourhood of Tadamon, the scene of heavy fighting, said a police station was destroyed.
"I saw five charred bodies strewn across the street," she told Reuters by telephone. "Seven police cars were torched ... some mosques in Damascus are calling on loudspeakers which shelters are available for people who have fled."
A witness said rebels attacked the main police headquarters in Damascus. "Gunfire has been intense for the past hour. It is now dying down but the streets around the police command remain empty," said a resident of Qanawat, an old central district where the Damascus Province police headquarters is located.
Other parts of the city were paralysed. Homes and shops were shuttered as Damascenes feared violence. Officials in neighbouring Lebanon said refugees were pouring across the frontier: a security source said 20,000 Syrians had crossed.
"Everyone is looking now at how well Assad can maintain the command structure. The killings yesterday were a huge blow, but not fatal," said a Western diplomat following Syria.
International diplomacy has been ineffective throughout the crisis, with Western countries condemning Assad but lacking the stomach for the sort of robust intervention that saw NATO bombers help blast Libya's Muammar Gaddafi from power last year.
Thursday's failed U.N. Security Council resolution, which would have extended a small, unarmed U.N. monitoring mission, was the third that has been vetoed by Russia and China.
The U.S. ambassador to the United Nations, Susan Rice, said the Security Council had "failed utterly", and Washington would look outside the body for ways "to bring pressure to bear on the Assad regime and to deliver assistance to those in need".
To replace the vetoed text, Britain proposed a four-paragraph resolution that would do nothing but extend the expiring mandate of the mission for another 30 days. Russia said it would consider it.
Areas of Damascus without fighting were largely deserted. Residents said the roads to many southern districts where fighting was heaviest were closed or peppered with checkpoints.
Syrian TV flashed a warning on its screen, telling residents gunmen disguised in Republican Guard uniforms were spreading through Damascus "planning to commit crimes and attack people".
Activists said real Republican Guard forces were in the Midan district. "We tapped into their walkie-talkies ... we are afraid of a massacre," activist Samir al-Shami said.
"Everyone in the neighbourhood is arming themselves. Some with machineguns, some with shotguns. Some even just with knives," one resident near Midan said.
"I can't even tell you what is going on outside because I've shuttered the windows and locked the doors. I just hear every now and then the gunfire, it's like it's in the room," said another resident near Midan reached by telephone.
People fleeing violent areas began searching for safe havens, some even taking refuge in the marble courtyards of the ancient Umayyad Mosque in Damascus's historic Old City.
The bombing on Wednesday seemed part of a coordinated assault on the capital that has escalated since the start of the week. Rebels call it the "liberation of Damascus", the climax of an uprising in which activists say 17,000 people have been killed.
A security source said the bomber who struck inside the security headquarters was a bodyguard for Assad's inner circle. Anti-Assad groups claimed responsibility.
U.N. Secretary-General Ban Ki-moon condemned the Damascus blast and expressed grave concern over the use of heavy weapons.
"Time is of the essence," he said. "The Syrian people have suffered for too long. The bloodshed must end now."
Elsewhere in the country rebels said they had "liberated" the town of Azaz in northern Aleppo province, bordering Turkey. Activists released video of the town of Talbiseh, in central Homs province, being sprayed with gunfire from helicopters.
Fighting also erupted near the Syrian-Israeli frontier. Israel promptly responded saying it would not accept refugees.
"In the event of the regime's downfall, which could happen... (Israeli forces) here are alert and ready, and if we have to stop waves of refugees, we will stop them," Defence Minister Ehud Barak said. (Additional reporting by Oliver Holmes, Samia Nakhoul and Dominic Evans in Beirut, Suleiman Al-Khalidi in Cilvegozu, Turkey; Writing by Peter Graff; Editing by Myra MacDonald)