Suicide bombers and gunmen attacked an election commission office beside the home of Afghan presidential candidate Ashraf Ghani on Tuesday and engaged in a lengthy gun battle with Afghan security forces.
The attack left 10 people dead, including five attackers, Interior Ministry spokesman Sediq Sediqi said.
The Afghan capital is on high alert ahead of an April 5 presidential election that Taliban insurgents have threatened to derail through a campaign of bombings and assassinations.
More than three hours after the initial explosions, sporadic gunfire could still be heard in the area, which had been cordoned off by police, a Reuters cameraman at the scene said.
Ghani, a former World Bank official, was not at home at the time of the attack.
The election would mark the country's first democratic transfer of power. President Hamid Karzai is barred from running for another term after 12 years in power but is widely expected to retain his influence.
The Taliban claimed responsibility for the attack.
Initially police said that militants had attacked Ghani's house itself, but later Ghani's campaign aide said the assault started from an adjacent building housing a provincial election office.
"The attack was on an election office next to Dr Ashraf Ghani's house. His house was also hit by the attackers. He is not at home but his family is there," the aide said.
The Interior Ministry said that there were two blasts followed by gunfire. There were no immediate reports of casualties.
"Only one of the attackers is still resisting from the top floor (of the election commission building), but others have been killed," Interior Ministry spokesman Sediq Sediqqi said.
Ghani wrote in a Twitter post after the attack: "Just arrived at Gardez rally, a huge crowd of tens of thousands." Gardez is in a volatile area south of Kabul.
Later, he added: "Terrorists cannot deter us from our cause with their cowardly attacks. My family is safe. Thank you to those of you who prayed for us."
The Taliban said in a statement that their suicide bombers had entered the adjacent building and blown themselves up.
"A number of suicide bombers attacked an important election center at the heart of Kabul," the Taliban said.
"The attack started with a very heavy explosion, and then a number of people entered with heavy and light weapons."
Last week, gunmen carried out an attack on the Serena Hotel in Kabul, killing nine people, including two children and four foreigners. The luxury hotel had long been considered one of the safest places to stay in Kabul.
The Guardian newspaper reported that among those killed in the hotel attack was Luis Maria Duarte, an election observer with the National Democratic Institute.
The NDI said it had pulled its elections observers from the country, while a senior European diplomat said observers from the Organization for Security and Co-operation in Europe had also left, according to the Guardian report.
The European Union's election monitoring program is the only major one still operating in the country.
Reuters-AP-Xinhua