A suicide bomber killed at least nine and wounded 12 in an attack on a police base in Kabul on Monday, an Afghan official said.

Kabul police spokesman Basir Mujahid said the attacker joined a line of people waiting to enter the local headquarters of a branch of the national police after having lunch and praying outside. The bomber detonated his explosives after being spotted near the gate.

"Unfortunately the majority of the killed and wounded are civilians," Mujahid said, adding that two police officers were among the dead and a third was wounded.

President Ashraf Ghani condemned the attack in a statement. "Such acts are unforgivable crimes against civilians," the statement quoting Ghani as saying.

"The government will never have talks with those groups who kill innocent civilians, women and children. Instead the Afghan security forces will mobilize in their fight against them."

A statement from the international military coalition in Afghanistan also condemned the attack and set a higher death toll, saying that 20 Afghan police officers were killed and 25 officers and seven Afghan civilians injured. The discrepancy between the two reported death tolls could not be immediately reconciled.

Afghanistan, Pakistan, China and the United States are due to hold a third round of talks in Islamabad on Saturday aimed at laying the groundwork for a direct dialogue between the Kabul government and the Taliban. Ghani has said that those insurgents who do not join the peace process will be wiped out.

The attack on Monday targeted the Afghan National Civil Order Police, a militarized force that often fights on the front lines of the war with the Taliban.

The attack took place in a busy part of western Kabul, near the zoo. Officials had initially said the explosion was caused by a suicide car bomb.

The Taliban claimed responsibility for the attack on Twitter. The insurgents, who have been at war with the government for 15 years, often target local security forces.