The terrorists first threw a grenade at the heavily guarded police station in the heart of Sopore, injuring a local Congress party worker.
According to the official, the grenade hit the roof of the police station, rolled down and exploded near the main entrance.
Once senior police officers reached the explosion site, terrorists who were hiding in the vicinity opened fire, triggering a gun battle.
Three police men were injured in the gun fight that started around 45 minutes after the grenade attack.
While the firing has stopped, the area has been cordoned off and searches are on for the terrorists.