(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 wounded — 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.

“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 wounded 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 as saying in the paper’s front-page story.

The gunman fired through the glass door of the newsroom, Phil Davis, a Capital Gazettepolice 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 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 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.

Brennan McCarthy, an attorney for the woman in the harassment case, told CNN that Ramos took information she shared with him in confidence “and then used those confidential facts and (took) them to an illogical end.”

In one instance, Ramos sent a letter to her employer saying she was a bipolar drunkard, which led to her being fired, the attorney said.

“They never had a romantic relationship at all and I don’t think that he ever really wanted a romantic relationship, “McCarthy said. “This was malevolence.”

“He had an issue with this woman. I don’t know what it was but he did everything he could to destroy her life. And he succeeded.”

Ramos posted veiled threats on social media and also turned his attention to McCarthy, re-posting McCarthy’s Facebook posts on social media, the attorney said.

“This is a man that actually stalked the attorney for the stalking victim,” McCarthy said

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 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 gave 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.

Suspect fired by an employer for “security suitability concerns”

In July 2014, Ramos was fired for “security suitability concerns” by his previous employer, Enterprise Information Services, where he worked as a help desk specialist within the Bureau of Labor Statistics in Washington, according to court documents.

Ramos sued his former employer, saying they still owed him money, and wrote in a letter, “No misconduct was ever cited to me and I received no explanation beyond ‘suitability concern.’ ”

Ramos said he spoke with his supervisor who told him “something has come to light,” but the supervisor did not explain what the issue was.

Enterprise Information Services filed a response to Ramos’ complaint, saying the federal government demanded he be terminated “citing security suitability concerns resulting from an Investigation conducted by the Office of Inspector General.”

The company said it was “never informed of the exact nature of the investigation.”

An email from a Bureau of Labor Statistics employee informed her co-workers at the time of his firing that Ramos would not be allowed on the premises “in order to mitigate potential security risk.”

Neither Enterprise Information Services nor the Bureau of Labor Statistics immediately responded to a request for comment on the nature of Ramos’ termination.

Identified through facial recognition technology

Surveillance recordings from inside the building Thursday show Ramos and the shootings, police said in a probable cause affidavit.

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.