(CNN) -- A gunman who opened fire at a New Jersey mall Monday night later holed up in a back room and shot himself in the head, authorities say.
No one else was injured in the mall shooting.
Richard Shoop's body was found at 3:20 a.m. Tuesday in an obscure part of Westfield Garden State Plaza mall, hours after he fired at least six bullets without striking anyone in the massive shopping center.
He acted alone, authorities say.
"We know that his intent was either suicide or to do something that would cause police to shoot him, which we call 'suicide by cop,' " Bergen County Prosecutor John Molinelli told CNN's "New Day."
"He had more than enough opportunity to be able to shoot other people," including a group adjacent to him, but he didn't, Molinelli said. "Instead, he shot randomly at different locations."
Shots hit the ceiling, an escalator, an elevator and a storefront, the prosecutor said.
The reasons for the shooting remain unclear. Shoop used narcotic drugs and sold drugs as well, Molinelli said.
And he left behind a note referring to the idea that the "end was coming," Molinelli said. "That could mean going to jail, getting arrested, or it could mean suicide." Authorities don't know whether Shoop left the note immediately before going to the mall.
Shoop's brother, Kevin, called authorities after hearing about the shooting and said he thought Shoop might be the gunman, Molinelli said. Police did not confirm the shooter's identity until they found his body.
"We're not sure exactly what caused him to do this, and we're all devastated," Kevin Shoop told reporters Tuesday.
"My brother intended to harm nobody else but himself. He just, sadly, decided to make ... an act of self-indulgence by taking his own life publicly. And it's a tragedy to us all," he said.
The melee started about 9:20 p.m. ET Monday night, just as the shopping center was about to close. Thousands of people were still in the mall, Molinelli said.
Shoop, dressed all in black and wearing a motorcycle helmet, walked through the mall with a rifle modified to look like an AK-47. The rifle was taken from Shoop's brother, Molinelli said.
Allie Cozic, who works in the mall, said everyone was "running to wherever they could."
"It was almost like when you're watching a horror movie and the killer is walking slowly. That's what it seemed like," she said. "He was wearing all black. It almost looked like body armor of some kind. As soon as I saw the gun, I just turned and ran."
Eddie Kahmann, another mall employee, said he heard six or seven gunshots.
"There was just people running like crazy, so I quickly just closed my doors, ran to the back, turned off all the lights, music and everything, just to stay hidden," he said.
The shooting sent panic through the mall and set off a frenzied hunt for the gunman. In the early hours of the search, officials weren't sure whether the shooter was still inside or outside the 2 million-square-foot building.
Officers did not fire any shots, Molinelli said, and there was only slight damage to the mall.
Even as Shoop's body lay in a remote room in a construction area, fear permeated the mall.
More than 100 shoppers were still hiding inside stores early Tuesday morning, unsure of whether they could safely come out. Officers worked to evacuate each store.
Signs of trouble
Shoop, 20, was known by local law enforcement. He had a history of drug use and abuse, Molinelli said.
"He at least thought that he was reaching a point where there was no recourse but to take his own life," Molinelli said.
The owner of a pizza shop where Shoop had been working for about a year said he was a good, trustworthy worker. Dod Geges, owner of Victor's Pizza Shop, describes Shoop as a nice, quiet guy.
But in the last two weeks, "something was off" about Shoop, Geges said, adding that he "wasn't his usual self."
Geges' brother Robert Gega, who manages the restaurant, said Shoop was working 60 hours a week and "sobering up."
"He wasn't drinking or drugging," Gega said, adding that Shoop had good friends and never gave an indication of contemplating suicide. "He would never hurt anyone."
CNN's Poppy Harlow, Nic Robertson, Susan Candiotti, Eden Pontz and Chuck Johnston contributed to this report.