Authorities in New Jersey announced on Thursday that they were investigating the killing of a police officer and an attack on a kosher supermarket on Tuesday, with three gunned down by a man and woman on a rampage, as an antisemitic hate crime.

“I can confirm we are investigating this matter as potential acts of domestic terrorism, fueled by antisemitism and anti-law enforcement beliefs,” New Jersey’s attorney general, Gurbir Grewal, said.

The two killers who shot dead a detective in Jersey City, then stormed a kosher supermarket and killed three bystanders, had apparently been followers of the Black Hebrew Israelites, a fringe group whose members have been known to rail against white people and Jews.

One of the suspects had made antisemitic posts online, a law enforcement official briefed on the investigation, but who was not able to disclose their name, said on Thursday.

Jersey City, with a population of 270,000 people, lies directly to the west of New York City, across the Hudson River from Manhattan, in New Jersey, and had erupted in a gun rampage that turned into an hours-long police shootout in the middle of the day on Tuesday.

The city is still reeling from the event on Tuesday that terrified the public in a busy part of town and left a police officer dead and two police wounded, as well as the killers and two other victims dead.

The findings stoked suspicions that the rampage was not a random crime but an antisemitic attack, even as state and federal authorities officially cautioned that the motive was still under investigation.

Nelson Rodriguez, 61, who has owned a shop in Jersey City for 22 years that sits just a few metres away from the grocery store, said that the whole episode was “terrible”.

After the shooting started, he said about 10 to 12 people ran into his shop to take refuge from the gunfire, at about 12.30pm ET.

From his shop windows, Rodriguez watched as police with huge guns stood outside the door and a tanklike vehicle went down the street to force open the front of the shop that was under attack.

“When I heard the noise of the bullets, I went outside and see the police and all the people shooting each other … It was like a war. It was terrible,” he said.

The FBI on Wednesday searched the Harlem headquarters of the Israelite Church of God in Jesus Christ, which is the formal name of the Black Hebrew Israelites group, according to the official, who was not authorized to discuss the case publicly and spoke on condition of anonymity. The Black Hebrew Israelites are a sect with no connection to Judaism that the Southern Poverty Law Centre lists as a hate group.

“The why and the ideology and the motivation that’s what we’re investigating,” Grewal said, adding that authorities are trying to determine whether anyone other groups were involved in planning the attack.

Others, including Jersey City’s mayor, Steve Fulop, pronounced the bloodshed a hate crime against Jews, with Fulop saying surveillance video made it clear that the attackers targeted the Jewish market, slowly and deliberately driving up to the grocery in a stolen rental van and immediately opening fire.

The attackers were identified as David N Anderson, 47, and Francine Graham, 50, both of them also prime suspects in the slaying of an Uber driver found dead in a car trunk in nearby Bayonne over the weekend, who was Jewish.

Anderson used a rifle in the grocery attack. Grewal wouldn’t confirm if Graham also had a weapon when she followed Anderson into the store. Several weapons were recovered from the store.

The victims killed in the store were Mindel Ferencz, 31, who with her husband owned the grocery; Moshe Deutsch, 24, a rabbinical student from Brooklyn, New York, who was shopping there; and a store employee, Douglas Miguel Rodriguez, 49.

Members of New York’s ultra-Orthodox Jewish community gathered on Wednesday night for funerals for Ferencz and Deutsch. Thousands of people followed Ferencz’s casket through the streets of Brooklyn, hugging and crying.

Det Joseph Seals, a 40-year-old member of a police unit devoted to taking illegal weapons off the street and a father of five, was gunned down by the assailants before they attacked the supermarket, authorities said. The killers then drove a van they were using about a mile to the kosher store.

The drawn-out gun battle with police filled the streets with the sound of high-powered rifle fire, as Swat officers in full tactical gear swarmed the neighborhood.

Immediately opposite the store, on Martin Luther King Drive, inside Sacred Heart school, children were led to the basement for shelter.