At least 54 people were killed and more than 100 injured Sunday when a suicide bomber detonated explosives near the Pakistan-India border, police said.

The incident occurred at the Pakistan side of the Wagah border crossing, minutes after the Pakistani and Indian military conducted the flag-lowering ceremony on their respective sides of the border, reports the Associated Press.

Large crowds gather every day at the Wagah border to watch an elaborate ceremony conducted by the Pakistani and the Indian militaries as the border gates are closed.

Three members of the Punjab rangers, the paramilitary force of Pakistan responsible for the security of Wagah border, also died in the attack.

The Punjab Rangers chief, Tahir Javed Khan, said that the blast happened when the suicide bomber detonated the bomb after he realized that he would not be able to get past the security barrier.

 "The suicide bomber failed to cross the security barrier and blew himself up outside when people were coming out," he said, reports The Guardian.

Jamaat ul Ahrar, a splinter group of the Pakistani Taliban, has claimed responsibility for the attack. Ehsanullah Ehsan,  a spokesman for  the group, said the attack was in revenge against the Pakistan army for killing innocent people of North Waziristan. The group will also conduct such attacks in the future, he added.

The Pakistan military had announced in September said that it had killed nearly 910 militants since initiating an offensive against them in the tribal zone of North Waziristan.

The operation Zarb-e-Azb was launched on June 15 against local and foreign militants in the Taliban bastion.

Meanwhile, Indian Prime Minister Narendra Modi condemned the attack as a "dastardly act of terrorism."

Ashok Kumar, inspector general of India's Border Security Force guarding Wagah, said the Indian side of the border was not affected by the explosion and India had increased its security in the area, reports Reuters.

Pakistan and India have so far fought three wars against each other. The two counties are also locked in a bitter conflict over the region of Kashmir, which both sides claim.

India blames Pakistan for promoting terrorist groups in Kashmir and for encouraging them to conduct attacks in India, a charge Pakistan refutes.