Heavily armed militants attacked a mountainous Indian army base near the de facto border with Pakistan on Sunday and killed 17 soldiers in the deadliest attack in Kashmir in more than a decade.

At the time of the attack, the army base in the heavily forested garrison town of Uri had a large number of troops because soldiers were handing over duties to a new battalion, the Indian army said in a statement.

More than 20 soldiers were injured, according to the army.

Militants barged into the fortified base through the rear gate just before dawn Sunday, threw grenades at the tents and temporary barracks where many soldiers were sleeping, and began shooting. The tents caught fire. In the ensuing gun battle, which lasted several hours, all four militants were killed, officials said. At least 13 of the 17 soldiers killed died in the fire.

It was the largest number of casualties suffered by the Indian army in a single Kashmir attack in more than two decades.

“We strongly condemn the cowardly terror attack in Uri. I assure the nation that those behind this despicable attack will not go unpunished,” tweeted India’s prime minister, Narendra Modi.

In Washington, the State Department said, “The United States strongly condemns the terror attack.”

Militants probably infiltrated from Pakistan during the night, said S.P. Vaid, a senior police officer in Kashmir. He said that a “state of high alert” has been declared in the state in the wake of the attack

Vaid described Uri as “an active infiltration route for militants.”

The base in Uri houses supplies for soldiers who are posted at the border with Pakistan, a senior defense official in Kashmir said.

“I woke up early to the sound of gunfire. We could not go back to sleep after that,” said Irfan Wadoo, a 28-year-old student in Uri who lives close to the army base. “The rattle of gunshots lasted for over four hours. Now, the army has stopped the movement of residents here after the attack.”

In a similar attack in January, armed men had scaled the compound wall and entered a front-line air base in the northern state of Punjab, near the border with Pakistan. Seven Indian security officers had died in the attack.

Indian forces this year have foiled at least half a dozen attempts by militants to infiltrate from across the border, officials said.

India’s defense minister, Manohar Parrikar, and the army chief is scheduled to visit Uri to inspect the site of the attack. Home Minister Rajnath Singh tweeted that he has postponed his trip to Russia and the United States to monitor the situation.

Singh also tweeted that there are “definite and conclusive indications that the perpetrators of the Uri attack were highly trained, heavily armed and specially equipped.”

No group has claimed responsibility for Sunday’s attack. But Singh said he is “disappointed with Pakistan’s continued and direct support to terrorism and terrorist groups.”

Other Indian political figures voiced outrage.

“For one tooth, the complete jaw,” Ram Madhav, general secretary of the ruling Hindu nationalist Bharatiya Janata Party, posted on Facebook. “Days of so-called strategic restraint are over. If terrorism is the instrument of the weak and coward, restraint in the face of repeated terrorist attacks betrays inefficiency and incompetence. India should prove otherwise.”

Amid rising calls for tough counteraction by Indians, Ranbir Singh, the director general of military operations, said the army is prepared and “any evil designs of the adversary shall be given a befitting reply by us.”

The officer said four grenade launchers, four AK-47 rifles and a large number of grenades were recovered from the dead militants. He said initial reports showed that they belonged to the group Jaish-e-Muhammad, a Pakistan-based Islamist group that has been designated a foreign terrorist organization by the State Department since 2001.

India and Pakistan, nuclear-armed foes, both claim Kashmir. Many Indian observers have accused Pakistan of supporting an armed separatist movement in the region for decades.

Sunday’s attack comes after more than two months of violent protests in Kashmir. More than 75 people have been killed and thousands more wounded by police fire, according to news reports. The angry, rock-throwing demonstrations erupted after Indian security forces killed a popular militant in July. Pellet guns used by police have caused more than 500 eye injuries; about 100 people have been permanently blinded.

In recent weeks, tensions have risen between India and Pakistan over the unrest in Kashmir. New Delhi accused Pakistan-based groups of fomenting the protests, a charge that Islamabad denies. The neighbors have fought two of three wars over the region since 1947.

Media reports said that Pakistan’s prime minister, Nawaz Sharif, is likely to raise the issue of Kashmir at this week’s U.N. General Assembly meeting in New York.

Ishfaq Naseem in Srinagar, Kashmir, contributed to this report.