Afghan police took up positions in Pul-i-Alam as militants attacked buildings
Taliban militants have attacked official buildings in eastern Afghanistan, firing rockets at a police headquarters and government offices.
Five Afghan police were reportedly killed and 26 others hurt as six gunmen fired grenades inside Pul-i-Alam.
Part of the city, capital of Logar province, was said to have been evacuated as military helicopters flew overhead and fired on the insurgents.
The attack comes 10 days before nationwide elections in Afghanistan.
The Taliban have vowed to disrupt the elections and have stepped up attacks in recent weeks.
US and UK forces are currently engaged in a major offensive against Taliban militants in the south of the country.
High casualty levels among the international coalition and reports of escalating violence have raised concerns in Washington and London.
The US commander in Afghanistan, Gen Stanley McChrystal, described the Taliban as "a very aggressive enemy" in a newspaper interview published on Monday.
Eyewitnesses in Pul-i-Alam said insurgents took up positions in an unfinished tower block and fired rockets into government compounds in the city, which is close to the capital, Kabul.
Two rockets were reported to have hit the headquarters of the city's chief of police, while four hit the governor's compound.
"The governor's building came under rocket attack from close range," local government spokesman Din Mohammad Darwish told AFP news agency.
"The rockets hit the building and partially damaged the building. The governor was having lunch and no-one was killed or wounded," he added.
Mr Darwish said attackers inside the buildings had been surrounded by the security forces. There were also reports of coalition helicopters involved in the fight.
A Taliban spokesman, Zabiullah Mujahid, claimed responsibility for the attack in Logar. He said that six fighters entered the buildings wearing explosive vests.
The attack in Logar was the latest in a series of similar co-ordinated attacks on provincial cities in recent months.
In July five people were killed in a series of strikes in eastern Afghanistan. This came after simultaneous assaults on government buildings in the city of Khost, also in eastern Afghanistan.
The BBC's Martin Patience in Kabul says that such attacks on provincial government compounds are designed to weaken the authority of the Afghan government.
The Taliban target provincial headquarters because they are not guarded as closely as institutions in Kabul, our correspondent says.
The significance of this attack is that it took place so close to the Afghan capital just days ahead of presidential elections.
Violence across the country has escalated in the run-up to presidential and provincial council polls on 20 August.
Speaking to the Wall Street Journal, Gen McChrystal - who is to present a major strategic review of the conflict to the US Congress this month - admitted US and international forces were facing a tough period in Afghanistan.
"We've got to stop their momentum, stop their initiative. It's hard work," he said.
On Sunday US National Security Adviser James Jones defended the US approach in Afghanistan, telling TV interviewers the developing strategy in the country was new and a system to judge progress was still being put in place.