People run away from the site of a clash between insurgents and security forces in Kabul, Afghanistan, Monday, Dec. 24, 2018. Image Credit: AFP

Militants detonated a car bomb before storming a Kabul government compound in an ongoing attack Monday that has caused casualties, officials and witnesses said, in the latest violence to rock the Afghan capital.

The raid caps a tumultuous few days in Afghanistan where officials are reeling from US President Donald Trump's plan to slash troop numbers, which many fear could harm efforts to end the 17-year war with the Taliban. It also comes after a major security shake-up in Kabul.

A number of gunmen raided the compound where the Ministry of Public Works and other offices are located, interior ministry deputy spokesman Nasrat Rahimi said.

A police officer was killed and another seven wounded, including three members of the security forces and four civilians.

But the health ministry said 16 wounded had been taken to one hospital alone.

Afghan forces have so far killed three of the attackers and freed more than 300 people trapped inside the compound, Rahimi said. A fourth attacker died in the car bomb explosion.

"There are still some hostages with the enemy and a clearance operation is ongoing," he said.

One of the wounded civilians broke several bones after jumping from the third floor of a building to escape the attackers, an AFP correspondent at a hospital said. Another two were wounded by broken glass.

There was no immediate claim of responsibility for the raid, which began mid-afternoon with a bomb-laden vehicle exploding at the entrance.

That was followed by a second blast, interior ministry spokesman Najib Danish said, though he did not specify its nature.

Plumes of black smoke could be seen rising from the compound, with at least two military helicopters circling above.

Journalists near the scene reported hearing numerous explosions in the hours after the attack began.

Ashraf, a witness who works at the Ministry of Public Works and who goes by one name, said militants inside the compound were exchanging gunfire with security forces.

"They are also firing at the NDS facility nearby," he told AFP after escaping the compound, referring to the Afghan spy agency, the National Directorate of Security.

Public works ministry spokesman Mehdi Rohani told AFP he and his colleagues were fleeing to a safe room.

"A car bomb detonated at the entrance of the ministry's parking lot," he told AFP by mobile phone as he ran from the scene.

"I can hear some gunfire outside the building. We are fine."

Soft targets 

An Afghan security source told AFP the gunmen had entered the office of the Ministry of Labor, Social Affairs, Martyrs and Disabled.

It is not clear if any employees were still inside the building.

The attack caps a tumultous few days for Afghanistan after an American official told AFP late last week that President Donald Trump had decided to pull out "roughly half" of the 14,000 US forces in the country.

The unexpected move stunned and dismayed foreign diplomats and Afghan officials in Kabul who are intensifying a push to end the 17-year conflict with the Taliban.

The assault also comes a day after President Ashraf Ghani appointed Amrullah Saleh and Assadullah Khaled, both former spymasters known for their anti-Taliban and Pakistan stance, to head the interior and defence ministries, respectively.

Militants have previously targeted government ministries and departments because they are often poorly defended and seen as soft targets.

Monday's attack was the biggest in Kabul since November 28 when the Taliban detonated a vehicle bomb outside the compound of British security firm G4S, killing at least 10 people and leaving a massive crater in the road.

While there has been no official announcement of a US drawdown, the mere suggestion of the United States reducing its military presence has rattled the Afghan capital.

Trump's decision apparently came Tuesday as US peace envoy Zalmay Khalilzad met with the Taliban in Abu Dhabi, part of efforts to bring the militants to the negotiating table with Kabul.