(NEW YORK) — A man accused of killing three people in an apparent unprovoked stabbing spree in Manhattan made his first appearance in court on Tuesday.

Ramon Rivera, 51, was charged with three counts of first-degree murder, according to the New York Police Department. He confessed to the killings during questioning, according to police sources.

The judge on Tuesday granted the prosecution’s request for remand. Rivera is set to return to court on Nov. 22.

The attacks unfolded within three hours on Monday morning.

The first victim, 36-year-old Angel Lata Landi, was fatally stabbed in the abdomen at 8:22 a.m. in an unprovoked attack by the construction site where he was working on West 19th Street, the NYPD said.

About two hours later, 67-year-old Chang Wang was fatally stabbed multiple times on East 30th Street, police said.

The third victim, 36-year-old Wilma Augustin, was attacked around 10:55 a.m. at 42nd Street and First Avenue. She had multiple stab wounds and was taken to a hospital where she later died, officials said.

The suspect — who was staying at the Bellevue Men’s Shelter on East 30th Street — was apprehended around East 46th Street and First Avenue, police said.

He appeared to pick the victims at random, police said.

“He just walked up to them and began to attack them,” Chief of Detectives Joe Kenny said at a news conference.

Two bloody kitchen knives were recovered, police said.

Rivera has eight prior arrests in New York City, according to law enforcement, and is believed to have severe mental health challenges, Mayor Eric Adams said. Rivera’s case renewed frustration with the city’s inability to treat people in mental distress and hold people with a history of low-level criminal activity.

“There’s a real question as to why he was on the street,” Adams said.

Rivera’s prior arrests mainly involved shoplifting, officials said. None involved a weapon.

He was out without bail pending trial on his most recent arrests.

He had two documented interactions with the city while in mental distress.

Copyright © 2024, ABC Audio. All rights reserved.