KABUL -- At least seven people have been killed after gunmen attacked the Communications Ministry in the center of the Afghan capital , officials say.
There was no immediate claim of responsibility for the attack that opened shortly before midday with an explosion at the entrance of the ministry in a busy commercial area of the city, followed up by gunfire.
Police chief General Sayed Mohammad Roshandil said a bomber blew himself up outside the ministry, clearing the way for the other attackers to enter the building and the heavily guarded government compound in central Kabul.
Interior Ministry spokesman Nasrat Rahimi told RFE/RL said four civilians and three soldiers were killed during the attack, which lasted several hours.
Eight civilians were wounded, he said. Health officials say the wounded people -- three of them women -- were transferred to hospitals.
Rahimi said the security operation ended at the ministry "after all four attackers were shot and killed by Afghan security forces."
He said the building was sealed off and all roads near the attack site were blocked by security forces.
Police shot and killed four other militants before they could reach their target of the nearby central post office, Rahimi added.
The official said some 2,700 government employees and civilians were rescued by security forces after being stuck in several government buildings.
President Ashraf Ghani condemned the attack, saying in a statement that the enemies of the nation were trying to create terror among the people by targeting civil servants.
Taliban spokesman Zabihullah Mujahid said on social media his group was not involved in the attack.
The explosion was also close to the heavily fortified Serena Hotel, one of the very few hotels still used by foreign visitors, in one of the main commercial areas of the city.
The attack comes after peace talks between the Afghan government and the Taliban in Qatar were canceled.
The talks, which had been scheduled for April 19, were considered a significant first step toward finding a negotiated end to the war in Afghanistan and the eventual withdrawal of U.S. troops.
It also comes the week after the Taliban announced its annual spring offensive.
The militants now control or influence about half the country, and last year was the deadliest yet for civilians.
Both Taliban insurgents and the Islamic State group are active in eastern Afghanistan and have previously claimed attacks in Kabul.