(Adds colour from scene, quotes)
By Marie-Louise Gumuchian and Ghaith Shennib
TRIPOLI, April 23 (Reuters) - France's embassy in Libya was hit by an apparent car bomb on Tuesday, injuring two French guards and bringing violence to the capital after attacks on foreign missions in the east.
It was the first assault on a diplomatic mission in Tripoli, considered safer than the rest of the North African country, since the end of the 2011 war that ousted Muammar Gaddafi, leaving Libya awash with weapons and roaming armed groups.
There have been several attacks on diplomatic missions, notably in the eastern city of Benghazi, where the U.S. ambassador and three other Americans were killed last September.
U.S. officials say militants with ties to al Qaeda were mostly likely involved in that attack but no-one has claimed it.
Al Qaeda's north African arm AQIM has warned of retaliation for France's intervention in Mali but there was no indication as to who was behind Tuesday's explosion at the embassy in Libya.
Residents living near the embassy compound, in the capital's Hay Andalus area, said they heard two blasts early in the morning around 0700 a.m. (0500 GMT).
A large chunk of the wall around the compound collapsed into rubble and one corner of the embassy building had caved in. Office cabinets lay scattered on the ground outside and water from a burst pipe ran down the street.
Residents pointed to shrapnel belonging to the car they said had exploded, such as a distorted wheel axle and pieces of the motor lying on the ground.
"We think it was a booby trapped car," a French embassy official told Reuters. "There was a lot of damage and there are two guards wounded."
French President Francois Hollande condemned the attack.
"France expects the Libyan authorities to shed light on this unacceptable act so that the authors are identified and brought to justice," he said in a statement.
Foreign Minister Laurent Fabius will travel to Tripoli on Tuesday, an official from his ministry said.
The Libyan army cordoned off the compound as dozens gathered outside. An embassy employee arrived at the scene and burst into tears when she saw the destruction. She was let inside to join colleagues and French security staff.
One resident living less than 100 metres from the embassy said his windows shook when the first blast occurred.
"I was in my house sleeping, when I was woken up by a long explosion. I went to my front door and found that it had blasted out," Osama al-Alam, lives next door to the embassy, said.
"I went into the street and saw smoke everywhere. We heard shooting and went inside the house."
His own house was badly damaged. Two cars outside the embassy were burnt out, others damaged. Parts of neighbouring homes were charred and damaged, their own front walls reduced to rubble. A palm tree in one front garden had fallen onto a roof.
"I think there were two blasts, the first was very loud and then there was a smaller one," another witness said. "There was some black smoke at first, and then it turned white."
Security remains precarious in post-war Libya, where militias often do as they please.
The bombing of the U.S. mission in Benghazi followed attacks on British, Red Cross and United Nations interests in the city.
Most foreign embassy staff and international aid workers have strict security in Tripoli and Benghazi remains off-limits to many foreigners.
Western countries have warned of growing militancy in North Africa following the deaths of at least 38 hostages in an attack on Algeria's In Amenas gas complex near the Libyan border in January, and the start of French military operations in Mali.
Al Qaeda's north African arm AQIM said on Friday it would retaliate after France sent troops to help Malian forces drive back an offensive by Islamist militants who had seized two-thirds of the country in the desert north.
"God willing, you shall see what will happen," AQIM's spokesman said in a twitter response to reporters on whether it planned future attacks on France.
"Repelling France's aggressive assault is an obligation of every Muslim not just al Qaeda."
(Additional reporting by John Irish and Leigh Thomas in Paris; editing by Anna Willard)