Saturday's attack began when a suicide bomber detonated explosives just outside the ministry building and three other assailants then entered the premises.
Three attackers were killed by security forces who battled and also evacuated over 2,800 Afghans from the government buildings.
Among the dead were four civilians and three police officers, while another eight civilians were wounded.
The Afghan affiliate of Islamic State, sometimes known as Islamic State Khorasan (ISIS-K) after an old name for the region that includes Afghanistan, has been active in the country since 2015, fighting the Taliban as well as Afghan and U.S. forces.It is difficult to say how many Islamic State fighters are in Afghanistan because they frequently switch allegiances, but the U.S. military estimates there are about 2,000.