Pathankot/New Delhi: At least four terrorists, suspected to be from Pakistan, were killed in a gunfight that lasted nearly 15 hours after they breached a high-security security perimeter and entered a frontline Indian Air Force (IAF) base near Pathankot town in northern Punjab early on Saturday to carry out a Fidayeen attack, police said.

A tweet by Home Minister Rajnath Singh had said five terrorists had been killed in the operation. This was later withdrawn. Prior to the initial tweet, the number of terrorists killed had been placed at four.

Police sources said that at least three IAF security personnel were killed and four others were injured in the terror attack that started around 3.30 am. The counter offensive lasted nearly 15 hours.

"We have also lost security personnel in the Pathankot attack. My heartfelt condolences to their families. We can never forget their sacrifice," the home minister said.

Though the firing initially stopped around 9 am after four of the terrorists were neutralised, sounds of firing and grenade explosions were again heard around 11.30 am. The counter-offensive ended after nearly 15 hours. The base is located around 250 km from Chandigarh.

The MIG-21 Bison fighter jets, MI-35 attack helicopters, missiles and other critical assets of the IAF at the base were secure and the terrorists were prevented from getting near the technical area where these were stationed, IAF sources said.

The IAF, in a statement in New Delhi, said that the terrorists' plan to destroy "valuable assets" was "foiled" due to "effective preparations" and "coordinated efforts".

The central government's response to the terror attack, which came just a week after Prime Minister Narendra Modi's 'surprise' visit to Lahore to meet his Pakistani counterpart, Nawaz Sharif, was measured, with Rajnath Singh talking of "peace" and a "befitting reply" in the same tone.

Rajnath Singh said in New Dellhi: "Any terrorist attack on us from Pakistan, and we will give it a befitting reply."

"Pakistan is our neighbour, we want peace, but any terror attack on India will get a befitting response," he added.

"It could have been worse. I congratulate my security forces for their valour and the way they tackled the terrorists," Rajnath Singh said.

The IAF claimed that the terrorists were detected by aerial surveillance platforms as soon as they entered the base.

The statement said intelligence inputs had been received of a likely attempt by terrorists to infiltrate into the military installation and preparatory action had been taken to thwart any such attempt.

The Western Air Command chief, Air Marshal SB Deo, was on location and personally supervised and coordinated with the Army, NSG and local civil police for exchange of information and operational activities, the statement said.

National Security Adviser (NSA) Ajit Doval monitored the terror attack from New Delhi.

National Security Guard (NSG) commandos, who had been rushed to Pathankot on Friday evening following apprehension of an attack, the IAF's Garud commandos and army commandos led the counter-attack on Saturday against the terrorists, who are suspected to have crossed into India from Pakistan through the border, 30 km from Pathankot.

The Punjab Police and its elite SWAT commando units provided the outer cordon to the counter-operations to ensure that no terrorist was able to escape.

"The terrorists were contained in one area of the air force station. They could not reach near the technical area of the air force station where IAF aircraft and other assets are located," a Punjab Police officer stationed near the IAF station said.

Intelligence officials said that the terrorists involved in the fidayeen attack could be from the Pakistan-based Jaish-e-Muhammed (JeM) terror outfit, as per PTI.

The terrorists, who were in army fatigues, were initially reported to be around four to six.

Two IAF attack helicopters and UAVs could be seen assisting security forces in the combing operations.

The Pathankot-Jammu highway was put on high alert. The entire area near the IAF station was sealed.

"The Air Force moved its barricades near the chowk around 5 pm on Friday. Area residents were alerted and told to remain inside. The first gunshots were heard after 3 a.m. and continued for the next 5-6 hours," Ashok Mehta, a local resident told the media, IANS reported.

Security forces were put on high alert in Pathankot district on Friday after a senior police officer had said he and his two companions were abducted by five armed men in army fatigues but released later.

This is the second major fidayeen attack by Pakistani terrorists in north Punjab in just over five months. A terror attack on Dinanagar town in Punjab's Gurdaspur district on July 27, 2015, left seven people dead, including a senior police officer.

With the opposition attack on the union government following the fidayeen attack, union minister Prakash Javadekar said that talks with Pakistan will take place with terror as the key issue.

"As far as Pakistan is concerned, it is our neighbour. Talks will take place keeping terror as the key issue," he said in New Delhi. "Prime Minister Narendra Modi has made a beginning, now it is Pakistan's turn to reciprocate."

Defence Minister Manohar Parrikar met NSA Ajit Doval and three service chiefs in New Delhi on Saturday to assess the situation in the wake of the terrorist attack.

A report from Islamabad said that Pakistan has condemned the terror attack.

In a statement issued in Islamabad, Pakistan's foreign office extended heartfelt condolences to the government, people of India and the bereaved families, Radio Pakistan reported.

"Building on the goodwill created during the recent high level contacts between the two countries, Pakistan remains committed to partner with India to completely eradicate the menace of terrorism afflicting South Asian region," the statement added.