Four men believed to be homeless were attacked and killed and a fifth man was injured in a brutal rampage in New York City overnight, police said.

A 24-year-old suspect who is homeless is in custody but has not been charged.

Police said he was found near one of the crime scenes in possession of a metal pipe.

The victims were brutally assaulted in the city’s Chinatown neighborhood in Lower Manhattan in three different locations, police said.

The assaults appear to have been “random attacks,” and the victims were apparently sleeping at the time they were assaulted, police said.

Officers first responded to reports of an assault around 2 a.m. and found an unconscious man lying in the street with severe head trauma. He was pronounced dead at the scene.

They were later approached by another male with head trauma, assistant police chief Stephen Hughes said in a statement Saturday morning. He was taken to a hospital in critical condition, police said.

Two witnesses told officers that a man dressed in a black jacket and black pants repeatedly struck one of the victims in the head with a metal object, according to Hughes.

Shortly afterward, authorities “observed a male fitting the description carrying a metal object.”

Hughes said officers took the man into custody and “recovered the metal pipe without further incident.”

About two hours later, police found three additional men dead a few blocks away. They had also died of head trauma injuries, police said.