There was no immediate claim of responsibility for the raid in the provincial capital of Herat, near the Iranian border, but the Taliban have been relentless in their assaults on Afghan police and soldiers.
Two police officers and three civilians, including a child, died in the attack that ended less than two hours after it began, the provincial governor's spokesperson Jelani Farhad said.
Another two officers were wounded. Both attackers were killed.
Police special forces were deployed to the area, interior ministry spokesperson Najib Danish said.
The latest violence follows a wave of Taliban attacks on Afghan forces, who have been dying in record numbers as the 17-year war grinds on.
The bloodshed comes as US peace envoy Zalmay Khalilzad visits the region for meetings aimed at bringing an end to the war in Afghanistan, which by some estimates was the world's deadliest conflict zone in 2018.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ