NEW DELHI — All six gunmen who infiltrated an Indian Air Force base near the border with Pakistan and exchanged fire with security forces have been killed, India’s defense minister said Tuesday.

Security forces were searching the base for explosives on Tuesday, the fourth day of the operation, Manohar Parrikar, the defense minister, said in a televised news briefing from Pathankot, in Punjab State, where the attack took place.

The attack, which began Saturday, was viewed as an attempt to undo recent improvements in the relationship between India and Pakistan. It came a week after Narendra Modi became the first Indian prime minister in 12 years to visit Pakistan in a step toward reviving dialogue between the two countries.

Seven Indian security personnel died in the gun battle at the base, which lasted several days. Ammunition recovered from the gunmen is believed to have come from Pakistan, Mr. Parrikar said Tuesday. The head of India’s National Investigation Agency told reporters that intercepts of phone calls made by the gunmen indicated that they had come from Pakistan.