At least 12 people have been killed and several injured in an attack on Libya's electoral commission headquarters in the capital, Tripoli, officials say.
At least one suicide bomber blew himself up while other armed assailants stormed the building and set it on fire, they say.
Voters have been registering for elections expected before the end of the year.
Libya has been in turmoil since Muammar Gaddafi was ousted in 2011.
After his 42-year rule, the country remains under the control of myriad rival armed groups.
Although many observers have questioned whether an election can be secured in the politically and militarily divided country, the international community appears hopeful that it would give the troubled North African state a fresh start.
Electoral commission spokesman Khaled Omar told Reuters that three officials and four security officers were killed in the attack. The health ministry later put the number of dead at 12.
Mr Omar said he saw the attackers, including two suicide bombers, storm the building and spotted bombers' body parts strewn on the ground.
He added that security officers had entered the building to respond to the attack in the Ghout al-Shaal district west of central Tripoli.
No group has claimed responsibility but militants with links to the Islamic State group are believed to have maintained sleeper cells in Libya's coastal cities.
By Rana Jawad, BBC North Africa correspondent
This attack is the deadliest and most elaborate of its kind in Tripoli in at least three years.
It may not come as a surprise, given Libya's precarious security conditions, but it will still have sent shockwaves around Tripoli because of the target and its reported victims, which included election commission employees.
In the past, attacks in the capital have mostly been confined to targeting security forces linked to the state or militias, as well as diplomatic mission buildings and foreigners.
The tactics used are reminiscent of the deadly attack on the Corinthia hotel in 2015 - in which nine people were killed.
Although it is not yet clear who carried out the attack, the target appears to crystallise a political message on the future of the country and attempts to move forward.
If indeed this was an attack by Islamist militants, as Libyan security forces suspect, targeting the core symbol of that expected change for the country will not be taken lightly.