Taliban insurgents have unleashed rockets and gunfire on the Afghan election commission's headquarters in the capital Kabul, a week before the country's presidential election.
Six hours after the attack began, security forces on Saturday gunned down the last of five gunmen who occupied a nearby building and targeted the heavily-fortified offices.
Independent Election Commission (IEC) spokesman Noor Mohammad Noor said its employees were unharmed after many hid for hours in reinforced safe-rooms.
Kabul airport, which is in the same eastern area of the city, was closed for several hours, with planes diverting to Karachi or returning to Delhi as well as other destinations.
The Taliban claimed responsibility for the attack via a recognised Twitter account.
Former New Zealand MP Chris Carter, who is working in Afghanistan, says more violence is expected.
Mr Carter, now part of the United Nations Development Programme, said he had been at the compound just half an hour before the attack.
He told Radio New Zealand's Sunday Morning programme if there's no clear winner from the 5 April vote, violence could continue until a run-off in June.
"In the election of four years ago there was a lot of difficulties in southern and eastern Afghanistan - these were the most insecure areas of the country," he said.
"International observers are predicting that this year it will be even more difficult to cast votes in those areas."
Taliban threatens polling staff
The Taliban group has vowed to disrupt the vote on 5 April, urging their fighters to attack polling staff, voters and security forces in the run-up to polling day, AFP reports.
The election to choose a successor to President Hamid Karzai, barred constitutionally from seeking a third term, will be Afghanistan's first-ever democratic handover of power.
But a repeat of the bloodshed that marred 2004 and 2009 elections would damage claims the 13-year US-led intervention has made progress in establishing a functioning Afghan state.
Saturday's assault came the day after Taliban attackers raided a Kabul guesthouse used by a US anti-landmine charity, killing two people. The guesthouse attack was the fourth this year in Kabul targeting foreigners or places where foreigners congregate.