TRIPOLI, Libya — A car bomb exploded Tuesday outside the French Embassy in Tripoli, wounding three people and partially setting the building on fire in the worst attack on a diplomatic mission in the North African nation since the US ambassador was killed last year.
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 Khadafy 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 Qaeda-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.’’
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 US diplomatic mission that killed US 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 Libyan security officials.
‘‘I heard a loud boom, and immediately after that, windows were shattered and parts of my house were damaged,’’ said Saqr 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 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 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.
Militias often act in the total absence of state control, making their own arrests and running their own prisons.