A foreign terrorist, belonging to the JeM and involved in terrorising locals, was killed in an encounter with security forces in Jammu and Kashmir's Shopian district on Friday, officials said.

An army official said based on specific inputs provided by Jammu and Kashmir Police regarding presence of terrorists in the Madrasa Darul Uloom Khalid Ibyn Walid in Kaprein village of Shopian, a joint cordon and search operation was launched in the area by the army and police.

"Maintaining surprise, multiple small teams converged towards the target area thereby sealing all possible escape routes. Special care was taken during the clearance of the target area as it included a madrasa having presence of three teachers and 31 students.

"It was also made sure that the masjid in proximity of the area was not used by the terrorist to take refuge and due restraint was exercised to prevent any damages to the masjid and madrasa during the operation," the official said.

The army said interrogation of suspected Over Ground Workers (OGW) by police revealed the presence, inside the madrasa, of the terrorist who came out and fired indiscriminately on security personnel in an attempt to escape.

"In retaliation, precision fire was brought down by security forces resulting in the neutralisation of the terrorist. One AK series rifle and other warlike stores were recovered from the terrorist."

The neutralised terrorist has been identified as Kamran Bhai, a resident of Pakistan affiliated to JeM.

"During the detailed search of the madrasa, two young kids of around 11 yrs age, who were tied up to the pillars with rope probably to be used as human shield by the dreaded Pakistani terrorist were elated to be rescued by the Army and JKP," army said.

"The terrorist was also involved in various nefarious activities in the area including terrorising the locals of the area and recruiting the gullible youth. His elimination will bring increased peace to the area and stymie recruitment of local youth into terrorism."