Munna Lahori, a Pakistani national, was responsible for a series of civilian killings in Kashmir, they said.
The second militant, an associate of Lahori, was a local militant, a police official said.
Lahori, also known as Bihari, had been used by Pakistan-based JeM terror group for the recruitment of militants, he said.
He was known for making Improvised Explosive Devices (IEDs). Acting on a tip-off about the presence of militants in Banday Mohalla in Bonbazar area of Shopian, security forces launched a cordon and search operation, the police official said.
The search operation turned into an encounter after the militants opened fire, leading to their killing, he said, adding that incriminating material including arms and ammunition were recovered from the site of the gunfight.
He was responsible for a series of civilian killings in Kashmir, they said. Lahori, also known as Bihari, had been used by the JeM terror group for recruitment, a police official said.