KABUL, Afghanistan — Heavily armed insurgents wearing suicide vests struck Tuesday at two of the most prominent symbols of the American diplomatic and military presence in Kabul, the United States Embassy and the nearby NATO headquarters, demonstrating the Taliban’s ability to infiltrate even the most heavily fortified districts of the capital.

As the insurgents fired rocket-propelled grenades, Westerners sought shelter — one rocket penetrated the embassy compound — and Afghan government workers fled their offices, emptying the city center. NATO and Afghan troops responded with barrages of bullets. At least 7 people were killed and 19 wounded by the insurgents.

The Taliban siege ended Wednesday morning after 19 hours with nine insurgents killed, three of them on Tuesday and the rest early Wednesday, said the Kabul Provincial police chief, Gen. Mohammed Ayoub Salangi.

At least five of the attackers had taken positions in a 14-story building under construction with clear sight lines to the targets.