Bail was denied Sunday for a man prosecutors accused of causing “mayhem” earlier this month at the Woodfield Mall in Schaumburg when he drove an SUV through the entrance of a store and plowed his way through the bustling shopping center.

Javier Garcia, 22, of Palatine, was charged with felony counts of terrorism and criminal damage to property, according to Schaumburg police and Cook County prosecutors. Before denying Garcia bail, Judge Mary Marubio explained the terrorism charge requires a mandatory no bail hold and carries a possible sentence of 20 years to life.

Assistant State’s Attorney Annalee McGlone had told the judge that Garcia initially walked into a Sears store about 2:20 p.m. Sept. 20 and eventually left without buying anything. After returning to his black SUV, Garcia drove off at “an exceedingly high rate of speed” a few minutes later and crashed into the store’s entrance, shattering glass and causing structural damage to the building, McGlone said.

The broken glass “sounded like multiple gunshots” and led some shoppers to believe there was an active shooter in the mall, McGlone said. Garcia then drove into the mall’s common area, nearly striking a train ride carrying children, the prosecutor said.

After driving through the glass facade of a Forever 21 store, Garcia’s SUV became wedged in the store’s entrance, McGlone said. That’s when he reversed the SUV and continued driving into the common area of the mall, weaving in and out of kiosks as some shoppers ran for cover.

“Chaos ensued amongst the patrons of the mall. Hysterical patrons were running and jumping in attempts to evade the vehicle’s path. Stores were locking their gates and sheltering people in the rear of stores for safety purposes,” McGlone said, noting that over 100 calls were made to 911 during the incident.

As the “mayhem” played out across the mall, Garcia continued driving until the SUV came to a stop after striking multiple columns, McGlone said. By the end of the rampage, Garcia drove more than halfway through the mall, but no one was struck.

Two off-duty police officers pulled Garcia from the SUV and held him until other officers arrived to take him into custody, McGlone said. Garcia, who has no criminal background, later admitted to driving through the mall.

No one was riding with him during the incident and no weapons were found in the SUV, McGlone said. The damage to the mall and the Sears store is currently estimated at over $110,000.

During a subsequent search of Garcia’s phone, investigators learned he had made 124 searches related to the mall between Sept. 19-20, McGlone said. Thirty-five of those searches focused on the Sears store, and 11 others were for the adjacent store.

The search of Garcia’s phone also revealed he had searched 21 times for a former teacher listed as a witness in the case, McGlone said.

Amil Alkass, Garcia’s private attorney, noted that Garcia was admitted to a psychiatric hospital for a week after being arrested at the mall, adding that his client takes psychiatric medications and is being treated for bipolar disorder and paranoid schizophrenia.

Alkass described Garcia as an unemployed high school graduate who lives with his father and sister, both of whom were present in court Sunday. Given Garcia’s condition and cooperation with law enforcement, Alkass asked the judge to set his client’s bail at $5,000 and release him on electronic home monitoring.

The judge rebuffed Alkass’ appeal, denying Garcia bail after calling him a “danger to the community” and citing the “chaotic scene” described by McGlone.

Garcia’s sister and father declined to comment after the hearing, but his attorney said the terrorism charge is “a little aggressive.”

“He’s definitely not a terrorist,” Alkass told the Chicago Sun-Times. “There was nobody targeted.”

Aviva Bowen, a spokeswoman for the state’s attorney’s office, said the last time she could remember Cook County prosecutors lodging terrorism charges was when three out-of-town activists were accused of making incendiary devices they allegedly planned to use in protests during the 2012 NATO Summit in Chicago.

Brian Church, Brent Betterly and Jared Chase — who came to be known as the “NATO 3” — were arrested after three Molotov cocktails were found at a Bridgeport apartment where they were staying. The trio allegedly planned to destroy President Barack Obama’s campaign headquarters, Mayor Rahm Emanuel’s home, police stations and a downtown bank.

The men were ultimately found guilty in 2014 of possession of incendiary devices and arson but acquitted of all terrorism charges.

Church received a five-year prison sentence, while Betterly was sentenced to six years and Chase got eight years. An extra year was later tacked onto Chase’s sentence when he was convicted in 2016 of squirting a Cook County correctional officer with a shampoo bottle filled with urine and feces.