The attack in the heart of the capital put new pressure on the Libya's new leaders to rein in the lawlessness that has gripped the country since 2011, when rebels ousted Moammar Gadhafi in a civil war and then refused to lay down their arms.
No group claimed responsibility for the attack, but suspicion fell on the militias and the extremists in their ranks that are fighting the central government in Tripoli for control.
Some Libyans blamed Islamic militants seeking to avenge France's military intervention in Mali to dislodge al-Qaida-linked forces from the northern part of the West African country.
The motive for the attack was not immediately clear. On its official website, the Libyan government denounced such attacks, which it said are "directly targeting Libya's security and stability."
French President Francois Hollande called the bombing an assault on all countries engaged in the fight against terrorism.
"France expects the Libyan authorities to shed the fullest light on this unacceptable act, so that the perpetrators are identified and brought to justice," Hollande said in a statement from Paris.
The Obama administration also condemned the violence, with State Department spokesman Patrick Ventrell calling it "a direct attack on all Libyans who fought a revolution in order to enjoy a democratic future with security and prosperity."
"We look to the Libyan government to continue its efforts to strengthen security across Libya and to bring the perpetrators of this crime to justice," he said.
Tuesday's bombing was the first in Tripoli, which has been relatively quiet. However, the eastern city of Benghazi saw a rise in violence last year, including the Sept. 11 attack by militants on the U.S. diplomatic mission that killed U.S. Ambassador Chris Stevens and three other Americans.
The explosives-laden car was detonated just outside the French Embassy in Tripoli's upscale al-Andalus neighborhood early in the morning, before any of its staff arrived, according to two Libyan security officials.
"I heard a loud boom, and immediately after that, windows were shattered and parts of my house were damaged," said Saqr al-Qarifi, whose home is adjacent to the embassy.
The blast wounded two French guards and ignited a fire at the embassy entrance that engulfed some of the offices inside, the officials said. A Libyan girl who was having breakfast in a nearby house was also hurt, Deputy Prime Minister Awad al-Barassi said on his official Facebook page.
Two cars parked outside the embassy caught fire and two other nearby buildings were damaged, said the officials, who spoke on condition of anonymity because they were not authorized to talk to the media. Smoke billowed into the sky, and video from the scene showed surrounding houses with scorched walls.
Hollande sent French Foreign Minister Laurent Fabius to Tripoli to assess the situation and bring home the two wounded French guards.
"This bombing was intended to kill, but France will not bend," Fabius said before he left Paris, adding that France was reinforcing security throughout the Mideast and the Sahel region of Africa.
French institutions in Tripoli, including schools and cultural centers, were ordered to suspend their activities immediately.
The attack site was later cordoned off. National guard and army units with armored vehicles surrounded the area, and Libyan Deputy Prime Minister Awad al-Barassi and Foreign Minister Mohamed Abdelaziz visited.
The attack presented the Libyan government with hard choices: either act to disband the powerful militias and risk even more widespread lawlessness, or tolerate the occasional violent backlash because the armed groups provide a measure of security.
Libyan leaders consider some of the militias to be "legitimate" forces while others such as Ansar al-Shariah are seen as outlaws.
However, both types of militias often act in the total absence of state control and oversight, making their own arrests, interrogating and taking confessions from detainees, and running their own prisons. At the same time, the government provides the militants with steady and even lavish salaries and rewards.
Omar Humidan, a spokesman for the General National Congress, which acts as Libya's legislative body, said government officials and lawmakers "are still weak" when it comes to providing security.
"The weapon, force and power must be in one hand - the state - not in hands of groups that are out of control of the state. This is the source of all dangers," Humidan said.
"The government must move and the people must give it all support in order to be able to integrate everything under the state command," he added.
Prime Minister Ali Zidan and his defense and interior ministers have been increasingly cracking down on some militias in the capital. Zidan also has reached out to France and other countries for training and technical aid in building Libya's security forces from scratch.
Many Libyans blamed Tuesday's attack on Islamic militants seeking to avenge France's military intervention in Mali, or on the militias seeking to send a message that cracking down on them by the government will only backfire.
"The No. 1 party benefiting from these attacks is the militias and the extremists. Whenever we take a step forward, an attack by these groups drags us back," said lawmaker Tawfiq Breik, from the liberal-leaning National Forces Alliance bloc in parliament.
"The message to the outside world is that Libya is slipping into terrorism. The goal is to empty the capital of foreign and diplomatic missions like Benghazi. The big loser is the Libyan people if no decisive measures are taken."
Libyans have been staging demonstrations demanding that authorities label all militias illegal. The protesters want members of the militias to be integrated into the Libyan army and not to owe their loyalty to their former commanders.
Tuesday's bombing will increase pressure already on army chief Maj. Gen. Youssef al-Mangoush, who is blamed for Libya's failure to take any concrete steps to build its military and stop the expansion of the militias.
France is a major ally of Libya, and the attack on the embassy was seen by many here as equal in its impact to the killing of Stevens, who aided Libyans during the civil war.
French officials have expressed concerns about the possibility of greater instability in Libya, where they believe at least some rebel fighters from Mali fled following Paris' military intervention.
Last week, al-Qaida in the Islamic Maghreb, or AQIM, threatened to seek revenge against all countries taking part in the war in Mali, warning that no one who participated will be safe.
It called on "all Muslims to target France and its interests and subjects inside and outside France until it withdraws the last soldier from the land of the Muslims and lifts its support of rulers of the region." That threat came as part of a question-and- answer session on AQIM's new Twitter account.
In the post-Gadhafi turmoil in Libya, several diplomats, relief agencies and churches have come under attack, and scores of Libyan security officials have been assassinated. In most cases, the government failed to find those responsible, either out of fear of counterattacks or because it lacks the ability to conduct a proper investigation.
The lawlessness prompted the U.S., Britain and other Western countries to close their missions in Benghazi and call on their nationals to evacuate the city.
Michael reported from Cairo. Associated Press writers Maamoun Youssef in Cairo and Thomas Adamson in Paris also contributed to this report.