Giving details of the incident, a police spokesman said that the encounter broke out in the Halmatpora area, at least 8 kms from the Line of Control or LoC, after a police party intercepted a group of terrorists.
A joint team of the Kupwara police along with companies of the Army, the Territorial Army or TA and the CRPF were engaged in the operations which began last morning.
The encounter has brought to light gaps in the Army's vigil along the LoC as the group of terrorists had managed to sneak in nearly 8 kms after crossing two ridges of the Shamsabari mountain range.
The terrorists had met their "reception party" (overground workers and terrorists already present in the Valley) after crossing the LoC and were proceeding towards Kupwara town when they were spotted by police personnel, officials said.
The terrorists, who were hiding inside a mosque, started running towards the forest, but not before four of them were killed by the security forces yesterday.
The fifth terrorist, who had hid himself at a height and was firing on the approaching security forces, was killed this evening, they said.
In the encounter, two policemen Deepak Thusoo and SPO Mohd Yousuf, two army personnel Sepoy Ashraf Rather of 160 TA and Naik Ranjeet Kholka of 5 Bihar lost their lives, the spokesman said.
Earlier in the exchange of fire, SPO Javaid Ahmad was injured. He was shifted to a hospital and his condition is stable, he said.
"Owing to the thick vegetation and low visibility, the security forces are mopping the area with due caution," the spokesman said.
Jammu and Kashmir Chief Minister Mehbooba Mufti paid tributes to the security forces' personnel killed in the encounter.