Three police officers are dead after suicide bombers and gunmen launched an eight-hour assault on the headquarters of Kabul traffic police in Afghanistan.

Afghan officials said it was the second coordinated attack on a government building in less than a week.

The Taliban claimed responsibility for the operation in which the officers and all five attackers were killed.

The attack began when three men detonated suicide bombs outside the main entrance.

The two remaining attackers then stormed the unfortified area, Deputy Interior Minister General Abdul Rahman said.

The pair, armed with automatic rifles, battled security forces outside the building nestled between two police hubs and close to parliament.

Thick smoke rose from the compound and an Afghan army helicopter hovered above as Afghan forces returned fire with rockets and machine guns.

The two gunmen were eventually killed by security forces, an interior ministry spokesman said.

The attack raised the possibility that insurgents were shifting tactics, testing Afghan security forces in Kabul after a series of high-profile attacks on Western targets last year.

Violence across the country has been increasing over the last 12 months, sparking concern about how the 350,000-strong Afghan security forces will be able to manage once foreign troops withdraw by the end of 2014.