Kabul, Afghanistan (CNN) -- The number of people killed when militants stormed an election commission office in the Afghan capital Tuesday has risen to five, a spokesman for the Afghan Interior Ministry said.
The victims were two police officers, two election commission workers and a provincial council candidate, said spokesman Sediq Sediqqi in Kabul.
Eight others were injured, including four police officers and four election commission staff, Seddiqi said.
After a five-hour gunbattle with Afghan security services, the five militants who carried out the attack were also killed, he said, bringing the violence to an end.
Two militants blew themselves up as they entered the compound in the Darul Aman area, he said, while the remaining three went into the election commission building.
"The attackers would have killed a lot of innocent people, as there were 70 people working in that building, if the Afghan security forces hadn't engaged them in the armed fight from outside," Sediqqi said.
The Taliban claimed responsibility for the attack, which comes less than two weeks before Afghanistan holds presidential elections.
Taliban spokesman Zabiullah Mujahid said in an e-mail that the group's armed suicide attackers had managed to enter the election commission office after causing a large explosion.
The election commission office is near the home of presidential candidate Ashraf Ghani, but his house did not appear to be the target of the attack. He was campaigning Tuesday in eastern Paktia province.
The Taliban have vowed to use force to disrupt the April 5 presidential vote.
The group also claimed an attack last week on the central Serena Hotel in which nine people died, some Afghans and some foreigners. Six people were also injured.
Among those killed were Sardar Ahmad, a senior reporter for the Agence France-Presse news agency, his wife and two of his three young children.
Official: Suicide bombers attack bank
In other violence Tuesday, at least five people were killed and 16 more injured when suicide bombers attacked a bank in Asadabad, the center of Afghanistan's eastern Kunar province.
Abdul Ghani Musamim, spokesman for Kunar's provincial governor, told CNN three insurgents stormed a branch of Kabul Bank, where police and other governmental workers had gathered to receive their salaries.
One detonated his explosives vest in front of the bank, while two others entered the building. One also blew himself up, and Afghan security forces shot the third attacker, Musamim said.
Two police officers, a soldier, a private security guard for the bank and a government worker were killed. The 16 injured included members of the security forces and civilians.
CNN's Masoud Popalzai reported from Kabul, with Laura Smith-Spark writing in London. CNN's Aliza Kassim and journalist Qadir Seddiqi contributed to this report.