In the largest terrorist attack in Pakistan in more than a year, a suicide bomber on Sunday detonated his explosives near the border with India following a joint India-Pakistan military ceremony, killing at least 57, including three Pakistani security personnel.

The group claiming responsibility for the attack, a faction of the Tehrik-e-Taliban Pakistan, said it was in retaliation for the Pakistan military’s recent offensive in North Waziristan targeting TTP bases. The U.S. must help shore up Pakistan in its fight against TTP militants, and, at the same time, encourage Islamabad to take the same tough stance toward Pakistan-based militants that attack India and Afghanistan.

The suicide bomber detonated his explosives in a parking area where Pakistani tourists were returning after observing the flag-lowering ceremony, which takes place daily at the Wagah border crossing. Tight security prevented the bomber from entering the ceremony grounds where Indian and Pakistani soldiers had just performed their ritual marches.

The attack is a reminder that Pakistan—a nuclear state with growing nuclear weapons stocks—continues to face formidable terrorist challenges. The Pakistani army started a major offensive against the TTP in June following a terrorist attack on the Karachi airport. The army claims to have killed more than 1,100 terrorists in the last four months, and the number of terrorist attacks in Pakistan has been on a relative decline recently.

Even so, in early September, terrorists attempted to take control of a Pakistani navy frigate, with the intent to use it as a weapon against American naval assets in the Indian Ocean. The Pakistani authorities successfully thwarted the terrorists’ plans, but the attempted attack shows the Pakistani navy is vulnerable to terrorist infiltration.

Pakistan turns a blind eye to—and even supports in some cases—terrorist groups that attack India and Afghanistan, such as the Lashkar-e-Taiba, which was responsible for the 2008 Mumbai attacks, and the Haqqani Network, which was responsible for several attacks in Afghanistan that have killed Afghans and coalition forces alike.

The TTP has links to both the LeT and Haqqani network, as well as al-Qaida, and exploits Pakistan’s permissive policies toward other terrorist groups to conduct its own anti-government attacks.

Narendra Modi, India’s prime minister, strongly condemned the Wagah attack, calling it a “dastardly act.” India’s new Bharatiya Janata Party leadership worries about terrorism leading to further instability in Pakistan, but its tough stance regarding terrorism conducted by Pakistan-based groups in India has led to a stalling of bilateral dialogue.

A resumption of bilateral talks between New Delhi and Islamabad would benefit the people of both countries. In particular, it would allow the Pakistani military to shift its focus from its eastern border with India to combating internal terrorism challenges. Doing so would require Pakistan to demonstrate its commitment to combating all terrorist groups that operate from its soil, including those that attack India.

Although the Pakistan Army leadership often cites India as a strategic threat to Pakistan, attacks such as the one in Wagah on Sunday show that the gravest threat to Pakistan’s future comes from within its own borders.