Updated

A fifth gunman was killed Monday on the third day of a siege at a heavily fortified Indian air base near the border with Pakistan and at least one attacker remained as troops worked to secure the sprawling compound, a military official said. Seven troops have been killed.

The search operations at Pathankot air force base will continue until all areas have been completely secured, Maj. Gen. Dushyant Singh, from India's elite National Security Guard, told reporters.

The attack has dragged on since early Saturday morning as government troops struggle to contain the heavily armed attackers. At least twice over the weekend it appeared that the attack had ended but fresh gunfire and explosions erupted both times.

Four attackers were reported killed by Saturday evening, and at least two were said to have been exchanging gunfire with troops as of Monday morning. By evening one had been shot dead, Singh said.

Defense officials have said authorities had been alerted about a potential attack in the area on Friday, and that aerial surveillance at the base spotted the gunmen as they entered the compound, leading to criticism of the handling of the situation.

Singh told reporters in Pathankot that it will take a "long time" to declare the base completely secure because of its size and geography. It is spread over more than 2,000 acres, including forests and tall grass.

The commanding officer of the base, Lt. Col. J.S. Dhamoon, described it as a "mini-city" with homes and a school for the children of the personnel stationed there.

An army statement said the last gunmen were firing from a building that is part of the living quarters on the base.

The base has a fleet of India's Russian-origin MiG-21 fighter jets and Mi-25 and Mi-35 attack helicopters, along with other military hardware. Officials have said no military hardware has been damaged in the fighting.

Military funerals were held Monday for the soldiers who were killed in the attack.

Their killings inside a military base despite intelligence alerts have angered many in India.

"The biggest problem is the multiplicity of command and control. Nobody knows who is really in charge," said Rahul Bedi, an analyst for Jane's Information Group.

The Pathankot base and the northern state of Punjab, where it is located, has "probably the highest concentration of military personnel in India because it's so close to the border with Pakistan," Bedi said.

"It's a huge embarrassment," he said. "It's a major goof-up for everybody."

Since Saturday morning, the base has been swarming with air force commandos, army soldiers, National Security Guard troops and local police. Officials, however, have refused to say how many security personnel were involved in the engagement.

There has also been no clear source of information on the attack for the media. Home Minister Rajnath Singh even tweeted Saturday night to congratulate the troops for successfully killing all of the gunmen.

The air force base is on the highway that connects India's insurgency-plagued Jammu and Kashmir state with the rest of the country. It is also very close to India's border with Pakistan.

The Himalayan region of Kashmir is divided between India and Pakistan and claimed in its entirety by both. Rebels in India's portion of Kashmir have been fighting since 1989 for independence or merger with Pakistan.

India accuses Pakistan of arming and training the insurgents, a charge Islamabad denies, and the attack is being viewed as a possible attempt to unravel recent progress in their relationship.

Police said they do not know if the gunmen came from Kashmir or from Pakistan. No group has claimed responsibility for the attack.

The violence follows Indian Prime Minister Narendra Modi's surprise Dec. 25 visit to Pakistan, where he met his counterpart, Nawaz Sharif. The two also held an unscheduled meeting at the Paris climate change talks last month.

Ahead of Modi's visit to Pakistan, the national security advisers of both countries met in Thailand. The foreign secretaries of both nations are to meet in Islamabad later this month.

The responses to the attacks from both countries have been muted so far, with neither New Delhi nor Islamabad giving any indication that the planned talks are under any threat.

All political parties in India have condemned the attack, but there were no demands that the government call off the talks with Pakistan. In the past, when it was in opposition, Modi's right-wing Bharatiya Janata Party was a vocal critic of engagement with Pakistan.