DHAKA: Militants in Bangladesh hurled homemade bombs and engaged in a gunbattle with police guarding the biggest Eid prayer in Bangladesh where at least 200,000 people were gathered Thursday morning.

Two officers, a woman and one suspected militant were killed, while at least 12 other people were injured, officials said.

At least one of the bombs exploded during the prayer at the sprawling Sholakia grounds in the district of Kishoreganj, about 90 kilometres north of the capital of Dhaka.

Kishoreganj on map.

After the blast killed two officers, police fired on the attackers and killed one of them, Assistant Superintendent Tofazzal Hossain said.

A female bystander was also killed in the crossfire. More than a dozen other people were injured with gunshot or bomb shrapnel wounds, including two in critical condition, he said.

Police cordoned off the area and searched the devotees as well as nearby houses for suspects in hiding, said resident Shafiqul Islam, who was among those offering Eid prayers.

The country's information minister said the target of the attack was a police convoy patrolling the Eid prayer gathering.

Tofazzal Hosain, who is the district's deputy police chief, told AFP that several people had taken part in the attack and some had been armed with machetes — a hallmark of recent killings in Bangladesh.

"They first threw a small bomb targeting police and then attacked them with machetes. Police retaliated by returning gunfire," he said.

A Bangladeshi policeman stands guard as Muslims offer Eidul Fitr prayers in Dhaka on July 7, 2016.— AFP

The private Somoy TV station broadcast footage of a gunfight between police and a group of attackers and reported that the slain policeman had been hacked to death.

Azimuddin Biswas, the district administrator, told AFP that the attack had taken place on the premises of a nearby school and not on the actual prayer ground.

"The congregation was not affected by the clashes," according to Biswas.

Tears, prayers on Eid

The violence comes just days after the country suffered a deadly hostage crisis in which 28 were killed, including 20 hostages, two policemen and six of the attackers.

It was the worst in a recent wave of extremist attacks in Bangladesh targeting atheists, religious minorities and others.

Many of the attacks, including the hostage taking, have been claimed by the militant Islamic State (IS) group.

On Wednesday, the extremist group released a video warning of more attacks to come in Bangladesh, according to the SITE Intelligence Group, which monitors militant activity online.

Bangladeshi Muslims offer Eidul Fitr prayers in Dhaka on July 7.— AFP

The Bangladeshi government, which has been cracking down on extremist groups for several years, has dismissed the IS claims as opportunistic, and says none of the attacks have been orchestrated from abroad.

Instead, the government blames homegrown militant groups of waging the violence in order to create political chaos in the country and undermine the secular government.

Many services that were held on Thursday to mark the start of Eid included pleas from religious leaders for an end to the violence.

"Allah, protect our country ... and protect our children from the evils of terrorism," Mohammad Sadequl Islam, the local imam, told a gathering of around 5,000 devotees at Dhaka's Mahakhali neighbourhood on Thursday.

Many of those who attended services in Dhaka could be seen openly weeping as clerics led prayers for a more peaceful and prosperous Bangladesh.