The Taliban has struck a government compound in eastern Afghanistan in a dawn attack that included two suicide truck bombings and left at least 12 people dead, including eight off duty policemen asleep in their quarters nearby.

The assault followed a stark message from the Taliban to world leaders gathered at a Nato summit in Wales, which will also discuss the drawdown of the alliance's mission in Afghanistan.

The exit of all foreign combat troops at the end of the year is proof that "no nation is able to subdue a free nation, especially a nation proud and free such as Afghanistan," the Taliban note said.

The attack started at sunrise, with the Taliban setting off two massive suicide truck bombs outside the government compound in the provincial capital of Ghazni, followed by an assault by nearly a dozen gunmen.

The assault triggered a gunbattle with policemen and security forces at the compound and officials said all 13 assailants were subsequently killed, including the two suicide bombers. The Taliban claimed responsibility for the attack in a text message sent to media.

The bombs blew out many windows across the city, and left about 200 people injured, mostly from flying glass, said Ghazni governor Musa Khan Akbarzada. He said one truck carved a 10-metre hole into the ground.

The bombings also destroyed Ghazni's city library and two museums, the governor said.

The attack comes as Afghanistan is embroiled in a political crisis with the country's April presidential election still without a clear winner. Two candidates vying to succeed President Hamid Karzai pulled their observers out of a ballot audit meant to determine the winner of a June run-off. The audit's final results are expected sometime next week.

Even though Nato forces are to leave Afghanistan, a small number of US and international troops may stay on after 2014 to advise and assist the Afghans. But that is likely contingent on Afghanistan signing a security arrangement with the United States, something Mr Karzai has so far refused to do. And despite the exit of most foreign forces, violence between the Taliban and the Afghan government is expected to continue.

Both presidential candidates - Abdullah Abdullah, a former foreign minister, and former finance minister Ashraf Ghani Ahmadzai - have pledged to sign the security deal. Had the vote been resolved, it was expected that Mr Karzai's successor would have attended the summit in Wales.

The Taliban needled the alliance ahead of the summit.

"Their 13-year-old occupation is now seen as a historical shame," said their statement. "It was planned that Afghanistan's next leader would participate in the Wales Summit. Now their plans have come to naught."

The election impasse has also hurt Afghanistan's economy, as customers worrying about the outbreak of civil war hold on to their money and investors put the brakes on new projects as they wait to see how the crisis unfolds.

The target of the Ghazni attack was apparently the local office of domestic intelligence, which is part of the compound, according to Asadullha Ensafi, the deputy police chief.

One of the truck bombs killed eight off-duty police officers who were asleep in their housing unit near the site, said Khan Pacha Shirzad, a police commander. Three members of the security forces and one civilian were also killed.

The Taliban regularly stages brazen attacks against Afghan forces and government institutions. In July, a suicide bomber blew up a car near a busy mosque and a market in the eastern province of Paktika, killing at least 89 people.

In other developments, the US-led international military coalition said one of its service members was killed in an attack in eastern Afghanistan.

Nato spokesman Major Paul Greenberg said he could not specify where the service member died but he said he did not believe there were any coalition troops at the Ghazni government compound during the Taliban assault.