The man accused of steering his car onto one of the busiest sidewalks in Times Square and mowing down pedestrians on Thursday told police he wanted to "kill them all," prosecutors said.

Richard Rojas, of the Bronx, was charged with murder, 20 counts of attempted murder, and five counts of aggravated vehicular homicide, police said.

In court on Friday, Manhattan prosecutors said that Rojas told police after he was arrested that he wanted to "kill them all" and that officers should have shot him. He also told them he was "hearing voices."

Rojas' lawyer did not comment on the case.

The 26-year-old was arrested Thursday afternoon after his car sped down three blocks in Times Square, hitting nearly two dozen people before steel security barriers finally stopped him.

An 18-year-old tourist from Michigan, Alyssa Elsman, was killed. Her 13-year-old sister was among the 22 injured, four of them critically.

The suspect had served in the U.S. Navy, but was discharged after disciplinary problems, military officials said.

MISSISSIPPI TEENS FACE CAPITAL MURDER CHARGES IN KILLING OF 6-YEAR-OLD BOY

Several witnesses told Fox News after the driver crashed, he tried to escape; however, he ultimately was pinned to the ground by five people who held him at the scene until police arrived.

"It sounded like a bomb going off," said Dave Willis, a tourist from the U.K. "I ran over and it was over in seconds. He was tackled to the ground."

Rojas initially tested negative for alcohol, but more detailed drug tests were pending, according to two law enforcement officials who were not authorized to speak publicly, and spoke to The Associated Press on the condition of anonymity. The officials said Rojas told officers he had been hearing voices.

OKLAHOMA POLICE OFFICER CLEARED IN MANSLAUGHTER CASE

The carnage unfolded in a part of the city that has long been considered a possible terrorist target because of its large crowds, a concern that became elevated after the Sept. 11 attacks and compounded by recent attacks in England, France, and Germany in which vehicles plowed through crowds of pedestrians.

Rojas' motivation was unclear, but Mayor Bill de Blasio said there was "no indication that this was an act of terrorism."

Police identified the woman killed by the car as a woman of Portage, Michigan, who graduated last year from Portage Central High School.

"If you didn't know her, you might think she's reserved or shy," school principal Eric Alburtus said. "But if you could talk to her for a minute, you'd realize she was engaging. She was bright. She was funny."

The Assocated Press contributed to this report.