This is an archived article and the information in the article may be outdated. Please look at the time stamp on the story to see when it was last updated.

NEW YORK CITY — A day after being hit with murder charges, prosecutors said in court Monday that the man dubbed the “subway slasher” had confessed to the series of deadly attacks.

After being questioned by police Saturday night, Rigoberto Lopez, 21, of Brooklyn, was charged Sunday in connection with four stabbings along the A line in under a 24-hour period, two of which were fatal.

At his arraignment Monday, prosecutors revealed that Lopez had confessed to all four stabbings, even telling police that the knife they found on him was the weapon he used.

Officials said Lopez, who was being held without bail, was to undergo a psychiatric evaluation. He is expected back in court again on Friday.

Lopez has been charged with one count of first-degree murder, two counts of second-degree murder, and two counts of attempted murder in the second degree, the NYPD said.

The first stabbing occurred around 11:20 a.m. Friday at the 181st Street Station along the A line in Fort George, Manhattan, police said. The 67-year-old victim told investigators a man walked up and stabbed him in the knee and left buttocks in a random, unprovoked attack, according to authorities. His injuries required treatment at a local hospital.

Later that day, around 11:30 p.m., officers were called to the Mott Avenue-Beach 22nd Street station in Far Rockaway, Queens, and discovered a man with numerous stab wounds to his neck and torso sitting inside a train car, according to the NYPD. The unidentified victim was pronounced dead at the scene, police said.

A few hours later, around 1:20 a.m. Saturday, a 44-year-old woman was found with multiple stab wounds to the chest and stomach, laying under a bench inside an A train stopped at the West 207th Street-Broadway station in Inwood, Manhattan, according to the NYPD. The woman, later identified as Claudine Roberts, was pronounced dead at the hospital, officials said.

About 15 minutes later, a 43-year-old man was stabbed multiple times in the back at the entrance of the 181st Street A line station where the first stabbing took place, police said. He was taken to a hospital in stable condition and underwent surgery, according to authorities.

All of the victims were believed to be homeless, police said.

Lopez, whose last known address is a homeless shelter in Brooklyn, was picked up by officers Saturday, near Audubon Avenue and West 186th Street in Upper Manhattan, police said.

Investigators initially identified him as a suspect while reviewing surveillance video near the 181st Street station, according to the NYPD. He was wearing the same clothes from the video when he was arrested, police said.

Lopez has several prior arrests, including alleged assault of a police officer, according to the NYPD. Police said they were aware he has had prior psychiatric evaluations.

The Upper Manhattan community came together Monday afternoon to honor the homeless New Yorkers who were either killed or injured on the A train line. Community members and elected officials demanded more resources for mental health and the homeless.

“Their anguish, their pain was not invisible, and their lives were not disposable,” Assemblywoman Carmen De La Rosa said. “And we must call for action to combat homelessness in our city and our state. On the state level, let’s tax the rich and help the poor.”

The NYPD deployed hundreds of additional officers to the subway system on Saturday in response to the stabbings and other recent attacks on riders and transit workers.

A joint statement released Saturday by interim NYC Transit President Sarah Feinberg and TWU Local 100 union President Tony Utano called for an immediate increase to the number of NYPD officers on subways.

“The recent horrifying attacks in the subway system are outrageous and unacceptable. Every customer, and each of our brave, heroic transit workers deserve a safe and secure transit system,” the statement said. “We have been calling on the city to add more police to the system, and to do more to assist those who desperately need mental health assistance. The time for action is now. We are demanding that additional resources be put into the system to address this challenge immediately. Our hearts go out to the victims, as we cooperate with active investigations and urge prosecutors to pursue maximum penalties for perpetrators.”

Mayor Bill de Blasio said in a statement Saturday that violence on the subway, or anywhere else in the city, would not be tolerated.

“Safe and reliable transit is critical to our city’s recovery, and we’ll continue to do all we can to keep our subways safe for straphangers across the five boroughs,” de Blasio said.