The suspected gunmen involved in a deadly Jersey City shooting Tuesday that killed four people, including a police officer, “targeted” a kosher grocery before engaging in an hours-long firefight with law enforcement, the mayor said Wednesday.

Authorities said David Anderson, 47, and Francine Graham, 50, killed 40-year-old Jersey City Police Det. Joseph Seals around 12:30 p.m. at Bay View Cemetery, then drove a white U-Haul van to the JC Kosher Supermarket on Martin Luther King Drive, where Anderson got out and immediately began shooting.

The three people killed in the attack on the store have been identified as Mindel Ferencz, 32, the wife of the store owner; Moshe Deutch, 24, a Brooklyn rabbinical student; and Miguel Douglas, 49, a worker at the grocery store who moved to the U.S. from Ecuador three years ago, New Jersey Attorney General Gurbir Grewal said at a Wednesday press conference.

Anderson and Graham, who barricaded themselves inside the market, died in an intense gun battle that lasted for hours in the Greenville neighborhood just across the Hudson River from Lower Manhattan. They were also identified Wednesday as the “prime suspects” in the killing of an Uber driver over the weekend.

“We now know that this did not begin with gunfire between police officers and perpetrators. It began with an attack on civilians in the store,” said James Shea, Jersey City’s director of public safety, said Wednesday morning. “There were multiple other people on the streets. There were many other targets available to them that they bypassed to attack that place.”

Investigators also recovered a live pipe bomb and “digital and documentary evidence” from the U-Haul, Grewal said.

Anderson was a one-time follower of the Black Hebrew Israelite movement, whose members adhere to both Christian and Judaic beliefs and claim to be descendants of ancient Israelites, NBC New York reported. The movement is designated as a “militant” hate group by the Southern Poverty Law Center, a legal advocacy group.

“Right now we are working to learn more about the shooters’ motivations,” Grewal said.

A music page that appears to belong to Anderson describes him as an “Original Hebrew-American” musician from Jersey City. The description aligns with some Black Hebrew Israelites’ descriptions of their movement. It is unclear whether Anderson still subscribed to those beliefs at the time of the shooting; the one song on the page was uploaded in 2014. The song is about a prison sentence Anderson served after what he claimed was a cover-up by Jersey City police.

Several news outlets also reported Wednesday that Anderson had previously published anti-Semitic and anti-police posts online. Investigators are reportedly reviewing the posts, but have not yet provided any details about their contents.

Jersey City Mayor Steve Fulop said Wednesday that the shooting was “a hate crime.” In another press conference Wednesday, New York City Mayor Bill de Blasio also called the shooting an “act of terror.”

“We shouldn’t parse words on whether this is a hate crime at this point,” Fulop said during a Wednesday news conference. “This was a hate crime against Jewish people and hate has no place.”

On Twitter, Fulop added: “It is also clear that the shooters have indicated on social media favorable sentiment towards groups that show antisemitism.”

Authorities said Seals was on duty and in plain clothes Tuesday when he approached the two suspects at Bay View Cemetery and was fatally shot. The pair then fled in a stolen white U-Haul truck to the kosher market about a mile away, Grewal said. Two officers who were near the store “immediately responded.”

Anderson “exited the driver side door of the U-Haul with a rifle” toward the store and “immediately began shooting,” Grewal said. Graham exited the car and followed Anderson inside shortly after.

The two suspects remained inside the store until authorities forced themselves inside. Several multiple law-enforcement agencies swarmed the market and engaged in an intense standoff. One person inside the store suffered a gunshot wound but managed to escape alive, authorities said.

In several videos taken outside the kosher deli, loud volleys of gunfire could be heard as bystanders pressed against police-tape barrier. One video showed a line of police armed with weapons and protective gear walking down the sidewalk in a single line.

Jersey City Mayor Fulop said an “extensive review” of the city’s surveillance footage indicated “that these two individuals targeted the kosher grocery location” where they opened fire and sparked a gun battle with police.

“The streets were filled with people and the schools surrounding were filled with people. With the amount of ammunition they had, we have to assume they would have continued attacking human beings if we hadn’t been there,” Shea said.