COLOMBO (Reuters) - Islamic State claimed responsibility on Tuesday for the bomb attacks in Sri Lanka that killed 321 people in what officials believe was retaliation for assaults on mosques in New Zealand.

The claim, issued through the group’s AMAQ news agency, was made after Sri Lanka said two domestic Islamist groups with suspected links to foreign militants were suspected to have been behind the attacks at three churches and four hotels. About 500 people were also wounded in the bombings.

Three sources told Reuters that Sri Lankan intelligence officials had been warned hours earlier by India that attacks by Islamists were imminent. It was not clear what action, if any, was taken.

President Maithripala Sirisena said he would change the heads of the defense forces following their failure to act on the intelligence.

“I will completely restructure the police and security forces in the coming weeks. I expect to change the heads of defense establishments within the next 24 hours,” Sirisena said in an address to the nation.

“The security officials who got the intelligence report from a foreign nation did not share it with me. I have decided to take stern action against these officials.”

Prime Minister Ranil Wickremesinghe told a news conference investigators were making progress in identifying the perpetrators.

“We will be following up on IS claims, we believe there may be some links,” he said.

The government has said at least seven suicide bombers were involved.

In a statement, Islamic State named what it said were the seven attackers who carried out the attacks. It gave no further evidence to support its claim of responsibility.

Th hardline militant group, who have lost the territory they once held in Syria and Iraq to Western-backed forces, later released a video on Amaq showing eight assailants, seven of whom were masked, pledging allegiance to Islamic State leader Abu Bakr al-Baghdadi.

Reuters could not independently verify the claim and authorities did not officially identify the assailants.

Earlier, junior minister for defense Ruwan Wijewardene told parliament two Sri Lankan Islamist groups - the National Thawheed Jama’ut and Jammiyathul Millathu Ibrahim - were responsible for the blasts, which detonated during Easter services and as hotels served breakfast.

The first six bombs - on three churches and three luxury hotels - exploded within 20 minutes of each other. Two more explosions - at a downmarket hotel and a house in a suburb of the capital, Colombo - took place in the early afternoon.

Wickremesinghe said the militants had tried to attack another hotel but had failed.

Sri Lankan government and military sources said a Syrian had been detained among 40 people being questioned over the bombs.

Most of the dead and wounded were Sri Lankans, although government officials said 38 foreigners were killed. That included British, U.S., Australian, Turkish, Indian, Chinese, Danish, Dutch and Portuguese nationals.

The U.N. Children’s Fund said 45 children were among the dead.

Footage on CNN showed what it said was one of the bombers wearing a heavy backpack. The man patted a child on the head before entering the Gothic-style St. Sebastian church in Katuwapitiya, north of Colombo. Dozens were killed there.

‘RETALIATION’

Wijewardene said investigators believed revenge for the March 15 killing of 50 people at two mosques during Friday prayers in the New Zealand city of Christchurch was the motive.

Slideshow ( 27 images )

“The initial investigation has revealed that this was in retaliation for the New Zealand mosque attack,” he said.

He did not elaborate on why authorities believed there was a link to the New Zealand bloodshed, unleashed by a lone gunman.

The bombs brought a shattering end to a relative calm that had existed in Buddhist-majority country since a civil war against mostly Hindu, ethnic Tamil separatists ended 10 years ago, and raised fears of a return to sectarian violence.

Sri Lanka’s 22 million people include minority Christians, Muslims and Hindus. Until now, Christians had largely managed to avoid the worst of the island’s conflict and communal tensions.

Pressure is likely to mount on the government over why effective action had not been taken in response to warnings from India about a possible attack on churches by the little-known National Thawheed Jama’ut group.

Slideshow ( 27 images )

Indian intelligence officers contacted their Sri Lankan counterparts two hours before the first attack to warn of a specific threat on churches, one Sri Lankan defense source and an Indian government source said.

Another Sri Lankan defense source said a warning came “hours before” the first strike.

Sri Lanka’s presidency and the Indian foreign ministry both did not respond to requests for comment on the warnings.

A government minister had said on Monday that Wickremesinghe had not been informed about a warning and had been shut out of top security meetings because of a feud with President Maithripala Sirisena.

Wickremesinghe dismissed any suggestion that the rift with the president had hampered coordination on security, saying although they had had differences they had been thrashed out.

Sirisena fired Wickremesinghe last year only to be forced to reinstate him under pressure from the Supreme Court.

FEARS OVER FUNERALS

Tuesday was a day of mourning and more than 1,000 mourners gathered for a mass funeral at St. Sebastian church in the coastal city of Negombo, just north of the capital, Colombo, where more than 100 parishioners were killed on Sunday.

The ceremony began with prayers and singing under a tent put up in the courtyard of the church, which had most of its roof torn away by the blast.

Pall-bearers wearing white carried in wooden coffins one by one, followed by distraught relatives.

Cardinal Malcolm Ranjith, the Archbishop of Sri Lanka who led the service, urged other churches to delay memorials amid fears that more bombers may be at large.

Security forces were on alert for more attack and the government imposed emergency rule giving police extensive powers to detain and interrogate suspects. An overnight curfew has also been in place since Sunday.

The government also said it had blocked online messaging services to stop the spread of inflammatory rumors that it feared could incite communal clashes.

The FBI is assisting Sri Lankan authorities with their investigation.

(GRAPHIC: Sri Lanka bombings - tmsnrt.rs/2Xy02BA)

(GRAPHIC: A decade of peace shattered - tmsnrt.rs/2W4wZoU)