There were no casualties in the incident and the militants were forced to retreat to Pakistan-occupied Kashmir.
"Army troops opened fire on a group of terrorists attempting to sneak into our territory yesterday night and forced them back across the Line of Control in Rampur sector of Baramulla district," the official said.
The Army has launched a combing operation in the area to ensure that none of the militants managed to get in.