ISLAMABAD, Pakistan — Suicide bombers and gunmen assaulted a busy government ministry in Kabul on Monday, leaving at least 29 people dead and scores wounded after some of the attackers rampaged through the building, taking workers hostage, and others fought a prolonged gun battle with local security forces, officials said.

Interior Ministry spokesman Najib Danesh said the bold, carefully coordinated assault on the Ministry for Martyrs and Disabled Persons left many of its employees dead or injured. He said at least 23 people were wounded, including three policemen, during eight hours of fighting around the compound in eastern Kabul. One policeman was killed.

Danesh said late Monday that police had successfully evacuated 357 employees from the ministry and that some employees had been able to hide from three attackers, who stormed the building with assault rifles and explosives after blowing up a car outside the front entrance. Officials said two of the attackers were eventually killed.

No militant group immediately claimed responsibility for the attack, the first major violent assault in Kabul since late November. The two-pronged tactic of a vehicle bomb followed by a commando-style gun attack was identical to previous attacks by Taliban insurgents on numerous official Afghan and foreign compounds.

The assault came just days after President Trump said he was considering pulling out as many as half the 14,000 U.S. troops currently serving in Afghanistan. The sudden development stunned the Afghan government, and experts said it could undermine peace talks with the insurgents by granting them a major concession.

In recent weeks, peace negotiations with the Taliban have been aggressively promoted by the Trump administration’s special envoy for Afghan peace, and meetings have been held that included representatives from the United States, Pakistan and Saudi Arabia, as well as senior Taliban leaders.

The Kabul government led by President Ashraf Ghani has not formally participated in the talks because the insurgents, who view Ghani as an American puppet, have insisted they will deal only with U.S. officials. Their major demand has been the complete withdrawal of U.S. forces and military bases.

At the same time, the insurgents have continued an aggressive campaign of attacks in many parts of the country, laying siege to the capital of Ghazni province in September and then targeting several long-peaceful districts, sending hundreds of people fleeing.

The possibility of thousands of U.S. troops leaving has sown confusion and panic in the Kabul government, although aides to Ghani have tried to play down its significance, saying Afghan forces are capable of defending the country.

On Sunday, Ghani suddenly announced he was replacing the ministers of defense and interior, the government’s top two security posts, with two former national intelligence chiefs known as anti-Taliban hard-liners.