The militants tried to enter the camp of 45 battalion CRPF at Sumbal in Bandipora at around 4.10 am by opening fire at the sentry post, a police official said.
He said the firing was retaliated by the guards even as police reinforcement was rushed to the scene of gunbattle.
"Four militants were killed in the retaliatory firing and the suicide attack was foiled," the official said.
He said four AK rifles,one UBGL and some ammunition were recovered from the slain militants.