(CNN) -- The accused gunman in the deadly shooting at Maryland's Capital Gazette newspaper barricaded the back entrance of the paper's office so people could not escape as he began "systematically hunting and killing," Anne Arundel County State's Attorney Wes Adams said Friday.
Authorities said Jarrod Warren Ramos, 38, stormed into the paper's Annapolis newsroom Thursday afternoon with a shotgun, killing five employees and leaving two others injured -- a few years after he unsuccessfully sued the newspaper for defamation.
Ramos concealed his weapon as he entered the building's back entrance, barricaded a back door and then opened fire, Adams said at Ramos' bail hearing Friday morning in an Annapolis court.
Ramos shot at least one victim who was trying to escape through the barricaded door, Adams said.
A witness earlier told CNN that she saw one of the slain victims get shot after he tried to open a back door.
"This fellow was there to kill as many people as he could get," Anne Arundel County police Chief Timothy Altomare said at a news conference Friday in Annapolis.
Police said that Ramos was arrested shortly after the shooting and that responding officers found him hiding under a desk. He has been charged with five counts of first-degree murder, according to court records.
A judge ordered Ramos held without bail at Friday's hearing.
Ramos, wearing a dark shirt, appeared in court via a video feed from a nearby detention center, standing silently as Adams made the allegations against him.
Ramos had a plan to escape, but it was thwarted when police responded, Adams said.
The five slain were Gerald Fischman, 61, editorial page editor; Rob Hiaasen, 59, an assistant editor; John McNamara, 56, a staff writer; Rebecca Smith, 34, a sales assistant; and Wendi Winters, 65, who worked in special publications.
The two injured employees, Rachel Pacella and Janet Cooley, have been treated at a hospital and released, Anne Arundel police Lt. Ryan Frashure said.
'Yes, we're putting out a damn paper'
Hours after the shooting, the Capital Gazette, a newsroom in mourning, published a newspaper with a front page bearing the photos of the five slain employees.
"We are heartbroken, devastated. Our colleagues and friends are gone. No matter how deep our loss is nothing compared to the grief our friends' families are feeling," Capital editor Rick Hutzell was quoted in the paper's front-page story.
The gunman fired through the glass door of the newsroom, Phil Davis, a Capital Gazette police reporter, tweeted shortly after the shooting. "There is nothing more terrifying than hearing multiple people get shot while you're under your desk and then hear the gunman reload," Davis wrote.
The newspaper, which was reeling from the attack, defiantly tweeted on Thursday: "Yes, we're putting out a damn paper tomorrow."
Several staffers and reporters from sister paper The Baltimore Sun worked on stories for Friday's paper.
The opinion page in Friday's paper was left mostly blank with a brief message: "Today, we are speechless. This page is intentionally left blank today to commemorate victims of Thursday's shootings at our office."
It listed the five victims' names.
"Tomorrow this page will return to its steady purpose of offering our readers informed opinion about the world around them, that they might be better citizens."
The defamation lawsuit
Ramos used a 12-gauge pump-action shotgun -- which he legally bought about a year ago -- to shoot and kill his victims, said Altomare, the county police chief. Police also have said Ramos had smoke grenades.
Police said they haven't determined a precise motive, noting the suspect hasn't cooperated with investigators. But they have said Ramos made threats against the paper a few years ago on social media and noted that he sued the publication six years ago.
"This was a targeted attack," Altomare said Friday.
Court documents show that Ramos filed a defamation suit against the paper and a reporter in July 2012. The dispute was over an article that detailed Ramos' guilty plea in a 2011 harassment case.
Titled "Jarrod wants to be your friend," the story was written by staff writer Eric Hartley and detailed the case where Ramos repeatedly contacted a former high school classmate via Facebook, according to court documents.
The case was eventually dismissed.
A Twitter account with Ramos' name and the handle @EricHartleyFrnd is believed to belong to Ramos, a law enforcement source said.
The account had tweeted several times about the paper and Hartley. By Friday morning, the account was suspended.
Police: Paper decided not to pursue charges in 2013
Altomare said his department investigated threatening online comments that Ramos allegedly made against the paper in 2013.
But that in a conference call between a detective and the paper's legal team that year, the Capital Gazette decided not to pursue charges because of fears it would exacerbate the situation, Altomare said.
The Capital Gazette had been threatened on social media with violence as recently as Thursday, police have said, without detailing who was behind those threats.
Anne Arundel County Executive Steven Schuh said Friday morning that Ramos had given no specific warning he was going to attack the newspaper.
"I don't believe there's any indication that this was anything more than a personal grievance from this individual directed toward the newspaper and its employees," Schuh said.
Identified through facial recognition technology
Surveillance recordings from inside the building Thursday show Ramos and the shootings, police said in a probable cause affidavit.
Altomare said police identified Ramos through facial recognition technology, using stored images -- perhaps such as driver's license photos -- from the Maryland Image Repository System.
Police did so after they had difficulty identifying Ramos through fingerprints, Altomare said.
Altomare said that earlier reports about Ramos' fingerprints having been mutilated or altered were incorrect. CNN previously reported from two law enforcement sources that the suspect's fingerprints appeared to have been altered.
Investigators have found evidence at Ramos' apartment in Laurel -- about a 30-minute drive from Annapolis -- showing "the origination of planning" for the shooting.
Altomare didn't detail the discoveries, other than saying the findings show "what we knew we would find, which is we have one bad guy."
A newsroom and a community mourn
Journalists at the newspaper tweeted tributes and memories of their colleagues.
"The Capital is not a big newsroom. There are about 20 news staffers, a few more advertising. We are close. We are family. I am devastated," reporter Danielle Ohl tweeted.
In a Facebook post, best-selling author and Miami Herald columnist Carl Hiaasen said he was "devastated and heartsick" to confirm the death of his brother, Robert Hiaasen, affectionately known as "Big Rob" because he towered over people.
"He spent his whole gifted career as a journalist, and he believed profoundly in the craft and mission of serving the public's right to know the news," Carl Hiaasen wrote.
A vigil for the victims will be held at 8 p.m. Friday at the Annapolis City Dock, city officials said.
Maryland Gov. Larry Hogan ordered state flags to be lowered to half-staff until sunset Monday.
"To the family, friends, and colleagues at the Capital Gazette and its parent company, The Baltimore Sun, you have the deepest sympathies of a state in mourning," Hogan said in a statement.
Clarification: This story has been updated to reflect new reporting from police regarding the suspect's fingerprints.
© Copyright 2018 CNN. All Rights Reserved. This material may not be published, broadcast, rewritten or redistributed.
for more features.