Major Kamlesh Pandey and Sepoy Tanzin Chhultim died in hospital.
Two soldiers -- a major and a jawan -- were killed and another jawan was injured when terrorists opened fire on security forces in Shopian district, south Kashmir, on Thursday, August 3.
A cordon and search operation had been launched by the army in Zaipora, Shopian, on Wednesday night following intelligence inputs about the presence of terrorists in the area, a police officer said.
During the search operation, the terrorists fired upon the search party, injuring the three army personnel.
The injured were taken to the army's 92 base hospital in Srinagar, but Major Kamlesh Pandey and Sepoy Tanzin Chhultim's lives could not be saved.
The other jawan is undergoing treatment.
The Hizb-ul Mujahideen has claimed responsibility for the attack.
The Himachal Pradesh government has announced Rs 20 lakh compensation to kin of Sepoy Chhultim.
Two terrorists were killed in a brief gunfight with security forces in Kulgam district, also in South Kashmir, on Wednesday night.
One of them was a Hizbul Mujahideen terrorist who was involved in a deadly attack on a bank cash van in May, a police official said.
Security forces launched a cordon and search operation at Gopalpora village in Kulgam district late on Wednesday night following information about presence of terrorists there, the official said.
He said in the ensuing gunfight, two local terrorists were killed.
They were identified as Aqib Hussain Itoo and Sohail Ahmad Rather.
The official said one of the terrorists was involved in an attack on a bank cash van in the district on May 1 this year which left five policemen and two bank guards dead.
He was also involved in the killing of a police constable in Yaripora area of Kulgam district last month.
The security forces have recovered two weapons from the site of the encounter, the official said, adding further details are awaited.