The slain ultras, trapped in the house in village Shatipora at Handwara, 90-km from here, were all foreigners, a police spokesman said.
Security forces laid a cordon around the village last evening after receiving specific inputs about the presence of militants there.
As a team of police, Rashtriya Rifles and CRPF zeroed in on the target, the ultras opened fire at them.
The security personnel returned the fire triggering a gunfight which ended in the morning, the spokesman said.
Two army jawans were injured in the gunbattle, the spokesman said. Three AK 47 rifles and nine magazines were recovered from scene.
The house where the militants were hiding was destroyed in the operation.