Bangladeshi police arrive near the scene of a blast in Kishoreganj, northeast of Dhaka, on Thursday. (Associated Press)

Assailants armed with explosives, guns and machetes attacked security forces at a large prayer gathering of Muslims in Bangladesh on Thursday, killing at least three people, police said.

The attack came with Bangladesh still in mourning — and authorities on high alert — after a terrorist siege last week in which militants took hostages at a popular cafe, hacking 20 people to death and killing two police officers in an attack claimed by the Islamic State. Many of the slain hostages were foreigners.

There was no immediate assertion of responsibility for the latest bloodshed, but the Islamic State had vowed to carry out more violence. The attack also shattered hopes that Eid al-Fitr, the Muslim celebration that marks the end of the holy month of Ramadan, would be peaceful after a week of carnage in Turkey, Bangladesh and Iraq.

On Wednesday, the State Department issued a warning to U.S. citizens to “carefully consider” the risks of travel to Bangladesh in light of the “series of terrorist events,” noting that the threat remains “real and credible.” One American was killed in last week’s bloodshed in Dhaka, the country’s capital.

A victim receives medical assistance after the attack. (Jamura TV via Associated Press)

Syed Abu Sayem, a senior police official, said that “several” men wielding pistols and machetes attacked a contingent of police in Kishoreganj, about 68 miles northeast of Dhaka.

About 100 yards away, more than 200,000 people had gathered in a field for a prayer service marking the end of Ramadan.

At least three people, including at least two police officers, were killed in the attack, Sayem said. One of the attackers also was killed, and three others were arrested, he added.

Bangladeshi Prime Minister Sheikh Hasina condemned the bombing of the faithful on a sacred holiday.

“How can people attack those who have been doing namaz?” Hasina said, using the word for the Muslim act of offering prayer.

Shahriar Hossain, a banker from Dhaka, said that he was walking to the prayer service when two men in traditional dress stopped him. One of the men took out a gun and started firing on a patrol team of police standing nearby, he said.

“I ran away in the opposite direction and heard the sound of many gunshots,” he said. He eventually took shelter in a nearby house.

Hossain said the attackers seemed to be aiming at the police, not worshipers.

“If they had targeted devotees, the casualties could have been hundreds,” he said.

The largely Muslim country of about 160 million has been in a state of heightened security since last Friday’s siege, with police checkpoints set up across Dhaka and probes expanding into possible terror cells.

Late Tuesday, the Islamic State, which had claimed responsibility for Friday’s hostage siege as it happened, issued a video threatening more violence to come, according to the SITE Intelligence Group, which monitors online terrorist activity.

“What you witnessed in Bangladesh was a glimpse,” the video warned. “This will repeat, repeat and repeat until you lose and we win and the sharia is established throughout the world.”

Bangladesh has suffered a string of killings of secular bloggers, foreigners, members of the gay community, Hindu priests and other minorities since 2013, violence that has intensified during the past year.

The government routinely attributes the attacks to homegrown radical groups, rather than to a global jihadist network such as the Islamic State or local affiliates of al-Qaeda, both of which have claimed responsibility in different incidents.

Hasina’s government, which retained power in a flawed 2014 election in which the opposition refused to participate, has arrested thousands in conjunction with the violence in recent days. Critics say that the government has used the arrest sweeps as an excuse to detain Hasina’s political opponents.

On Thursday, Bangladesh’s information minister, Hasanul Haq Inu, told local reporters that the attack in Kishoreganj was “political” and did not have an “Islamist agenda” behind it.

Azad Majumder in Dhaka contributed to this report.