One of the encounters broke out after security forces launched a cordon and search operation at Futlipora in Pakherpora area, 45 km from Srinagar, following information about presence of terrorists in the area, an army official said.
He said the terrorists opened fire on security forces, who retaliated, triggering a fierce gun battle.
"Four militants were killed in the gun battle," the official, said adding the operation was still in progress.
A police official said three of the gunned down terrorists were foreigners while one was a local, identified as Shabir Ahmad Dar. The official said the ultras belonged to the JeM.
One security force personnel sustained injuries during the operation while eight civilians were injured in the action by the security forces against protesters who were trying to disrupt the anti-militancy operation.
In another encounter at Bomai in Sopore area of Baramulla district, security forces shot dead one terrorist, a police official said.
The gunned down terrorist has been identified as Muzamil, a resident of Pakistan, who was affiliated with Lashkar-e-Tayiba, the official said, adding a cache of arms and ammunition was recovered from him.
Image for representation only.
'Need to tell Kashmiris that 'aazadi' is not possible'
'Kashmir is a battle of the mind'
Wailing mother's plea compels young LeT terrorist to surrender
Stone pelter vs cop: A Kashmiri portrait
Why did Afshan Ashiq, the footballer, turn into a stone-pelter?