The gunman who killed five people with a shotgun at an Annapolis, Maryland, newspaper office did so as part of a "coordinated attack" that included barricading the building's back door so no one could escape, prosecutors said Friday.

A district court judge ordered that suspect Jarrod Ramos, 38, be held without bond after he was charged with five counts of first-degree murder in Thursday's mass shooting at the Capital Gazette office. He appeared at the hearing via teleconference wearing a black jumpsuit, and did not speak.

Wes Adams, the Anne Arundel County state's attorney, later described the killings as a "brutal series of attacks on innocent victims," and said he told the judge that Ramos remains a flight risk and danger to the community.

Ramos had a "tactical approach in hunting down" those victims, Adams said at a news conference, adding, "There was one victim that had attempted to escape through the back door and was shot."

Charging documents made public Friday also revealed how the gunman hid under a desk after shooting through a glass door and opening fire inside the newsroom. But officers quickly found and arrested him without exchanging gunfire, officials said at a news conference.

"He didn't run away, he hid," Anne Arundel County Police Chief Timothy Altomare told reporters.

He added that Ramos used a 12-gauge, pump-action shotgun that was legally purchased a year ago.

"The fellow was there to kill as many people as he could kill," the police chief said.

Surveillance video at the building helped authorities to confirm Ramos' connection with the shooting, which also left two others with superficial injuries, according to charging documents.

Ramos could be sentenced to life in prison with no parole if found guilty. A preliminary hearing could be scheduled in 30 days or the case could go before a grand jury.

While officials are calling the shooting a "targeted attack" and Ramos' actions as "premeditated," a motive for what prompted Thursday's massacre remains unclear.

Annapolis Police Chief Scott Baker told "Today" that the suspect was being uncooperative and has said very little. He did have an acrimonious history with the newspaper stemming from a 2011 column that reported his guilty plea to criminal harassment, Baker said.

"I think we got to get to the real why. I think we know in somebody's head why, but I don't think we've been able to nail down clinically to bring this thing to closure," Baker added. "There's a lot more questions we have to answer."

Ramos burst into the newsroom just after 2:30 p.m. ET with the shotgun as well as smoke grenades, police said. Journalists began tweeting for help from an active shooter, and described having to hide underneath desks and hearing the sound of a firearm reloading.

Anthony Messenger, a sports intern at the Capital Gazette, told "Today" that after hearing the gunfire, he and a colleague tried to run through a back door that is normally kept open but found it was jammed.

The two hid under a desk and wanted to call 911 but were afraid their voices would draw the shooter to them.

"At that moment, I thought I was going to die, I thought we were going to die," Messenger said.

Police officers arrived at the scene within 30 seconds of the first emergency call.

Ramos was identified through the use of facial recognition software and authorities had executed a search warrant at his home in Laurel in neighboring Prince George's County where he lives alone.

Ramos initially pleaded guilty in July 2011 to criminal harassment in Anne Arundel County, where the Capital Gazette is based. A 90-day jail sentence was suspended, and Ramos was placed on 18 months of supervised probation.

The Capital Gazette later profiled a former female classmate who said she was victimized by Ramos. She claimed that Ramos tracked her down on Facebook and then harassed her online for as long as two years.

Ramos in 2012 sued the newspaper and the court reporter who wrote the column for defamation as well as invasion of privacy. A circuit judge dismissed the complaint in 2013, saying it had not proven that anything published was false. While Ramos appealed the dismissal, an appeals court in 2015 upheld the decision.

Thomas Marquardt, the newspaper's publisher at the time, said on MSNBC that Ramos had created a web page that included rantings against The Capital.

"He continued to post on his website really negative comments, often profanity-ridden, that were vague threats against our lives and our reputation," Marquardt said.

Marquardt went to police in 2013, but decided not to move ahead with a formal investigation. He said he did have a picture of Ramos placed at a front desk and advised for 911 to be called if he ever walked in.