A suicide blast rocked the Afghan capital Kabul during a gun battle with security forces.

Police chief Sayed Mohammad Roshandil said the bomber blew himself up outside the telecommunications ministry, clearing the way for four gunmen to enter the building and the heavily guarded government compound.

Nasart Rahimi, a spokesman for the Interior Ministry, said four civilians and three soldiers were killed during the attack. Eight civilians were also injured.

Kabul blast
Workers fled nearby buildings amid the attack (Rahmat Gul/AP)

No group has yet claimed responsibility for the attack. Both Taliban insurgents and the Islamic State group are active in eastern Afghanistan and have previously claimed attacks in Kabul.

Mr Rahimi said the security operation ended “after all attackers were shot and killed by Afghan security forces”.

The attack came a day after Afghan-to-Afghan peace talks in Qatar were cancelled.

It would have marked the first time that Taliban and Kabul government officials sat together to negotiate an end to the war in Afghanistan and a withdrawal of US troops.

Afghan president Ashraf Ghani strongly condemned the attack in a statement, saying the enemies of Afghanistan, by targeting civil servants, are trying to create terror among the people.

Afghanistan
Staff of the Telecommunication Ministry are escorted to safety amid the attack (Rahmat Gul/AP)

Mr Rahimi said security forces blocked all roads near the attack site and forces shot and killed four additional suicide bombers before they could reach their target of the nearby central post office.

He said as many as 2,700 government employees and civilians were rescued by security forces after being stuck in several government buildings, including the post office.

Hamid Popalzai, an employee of the Telecommunication Ministry, said “an explosion happened and then we heard the sound of gunfire and more explosions”.

He added that a large number of people were inside the ministry, both women and men, when the attack began.

Live footage on local TV showed government employees fleeing neighbouring Information and Culture Ministry buildings, with some climbing out of windows.