He appeared in court on charges of making terroristic threats and making terroristic threats as a hate crime.
Ramirez was arrested last month by Port Authority Police on the New Jersey side of the Lincoln Tunnel on his way into Manhattan after he posted online about killing Jews.
One post mentioned Central Synagogue, a large congregation in Midtown, prosecutors said.
The Manhattan district attorney's office asked the judge to hold Ramirez without bail
"This is a serious offense. He made terroristic threats that he was Adolf Hitler reincarnated," prosecutor David Stuart said during the arraignment. "There are serious mental health concerns."
Ramirez was at a military officer cadet school in Virginia when he allegedly made some of the threats, prosecutors said. While incarcerated, Ramirez was diagnosed with "some serious mental health disorders," including psychosis and delusions.
The judge agreed to remand him, citing mental health concerns, risk of flight and "his behavior during this behavior."
Court officers twice had to remind Ramirez to face forward and look at the judge.
"Luis Ramirez allegedly made extremely disturbing and serious threats against Central Synagogue, and we have absolutely no tolerance for this conduct," District Attorney Alvin Bragg said. "He is now charged with significant terrorism and hate crimes charges and was remanded into custody. Any form of antisemitism is despicable, and I want Manhattan's Jewish community to know we are remaining extremely vigilant."
(ABC News contributed to this report.)
----------
* Get Eyewitness News Delivered
* More Manhattan news
* Send us a news tip
* Download the abc7NY app for breaking news alerts
* Follow us on YouTube