Two men were stabbed just blocks apart on the Upper West Side near Central Park by a suspect who yelled out “Allahu Akbar” before the midday attacks, according to police.

A 57-year-old man was walking near West 84th Street and Central Park West just after 1:30 p.m. Thursday when a man came up from behind him and stabbed him in the back without warning, police said.

The suspect continued walking to 86th Street and Amsterdam Avenue, where minutes later, he allegedly stabbed a 50-year-old man in the chest.

Both victims were taken to Mount Sinai Morningside, where police described their conditions as “stable,” but no further details about their respective conditions were shared.

The suspect was seen by a witness walking into a building on Amsterdam Avenue a few blocks away. An hour later, police arrested 51-year-old Raul Morales in connection with the stabbings. No other individuals were being sought, according to a post by NYPD Commissioner Jessica Tisch on X.

The police commissioner added that, according to victim and witness statements, Morales yelled “Allahu Akbar” during both attacks.

“While the perpetrator has no known mental health history with the NYPD, the initial investigation suggests that mental health may have been a factor,” the post by Tisch read.

While a motive for the stabbings was not clear, the NYPD was looking into whether it may have been a potential hate crime. One of the victims is Asian, the other is Jewish.

Tisch said there was no known link between Morales and the victims, and the victims did not appear to know each other.

New York City Mayor Zohran Mamdani called the stabbings “horrifying” and praised officers for their quick response to the scene.

“These hateful and despicable attacks have no place in our city,” the post by Mamdani read.

Gov. Kathy Hochul posted on X she was “disgusted” by what she called “another senseless attack on New Yorkers simply because they’re Jewish.” New York City Council Speaker Julie Menin said in a post she was “sickened and furious” by the incident.

“While we await additional details to be confirmed, we know that what is happening in our city is abhorrent. The fear in the Jewish community is real. Every New Yorker deserves to feel safe in their neighborhood, regardless of their faith or identity,” said Menin.

An investigation is ongoing.