ANNAPOLIS, Md. (AP) — The gunman accused of killing five people in a vendetta against a Maryland newspaper barricaded the rear exit to prevent anyone from escaping and blasted his way through the newsroom with a pump-action shotgun, cutting down one victim trying to slip out the back, authorities said Friday.

"The fellow was there to kill as many people as he could," Anne Arundel County Police Chief Timothy Altomare said after Jarrod W. Ramos, 38, was charged with five counts of murder in one of the deadliest attacks on journalists in U.S. history.

Ramos' long-held grudge against the Capital Gazette included a string of angry online messages and a failed defamation lawsuit over a column about him pleading guilty to harassing a woman. Police looked into the online threats in 2013, but the paper declined to press charges for fear of inflaming the situation, Atltomare said.

"There's clearly a history there," the police chief said.

Ramos was denied bail Friday after a brief court hearing in which he appeared by video, watching attentively but not speaking. Authorities said he was "uncooperative" with interrogators.

His public defenders had no comment outside court.

Three editors, a reporter and a sales assistant were killed in the Thursday afternoon rampage.

The killings initially stirred fears that the recent political attacks on the "fake news media" had exploded into violence, and police tightened security at news organizations in New York and other places.

But by all accounts, Ramos had a specific, longstanding grievance against the paper.

At the White House, President Donald Trump, who routinely calls reporters "liars" and "enemies of the people," said: "Journalists, like all Americans, should be free from the fear of being violently attacked while doing their jobs."

Prosecutor Wes Adams said Ramos carefully planned the attack, barricading the back door and using "a tactical approach in hunting down and shooting the innocent people."

Adams said the gunman, who was captured hiding under a desk and did not exchange fire with police, also had an escape plan, but the prosecutor would not elaborate.

The attack began with a shotgun blast that shattered the glass entrance to the open newsroom. Journalists crawled under desks and sought other hiding places, describing agonizing minutes of terror as they heard the gunman's footsteps and the repeated blasts of the weapon.

Some 300 local, state and federal officers converged on the scene and within two minutes police had begun to corner Ramos, a rapid response that "without question" saved lives, Altomare said.

The police chief referred to Ramos as "the bad guy," refusing to utter his name because "he doesn't deserve for us to talk about him for one more second."

Ramos was identified quickly with the help of facial recognition technology because of a "lag" in running his fingerprints, the chief said. Police denied news reports that Ramos had mutilated his fingertips to avoid identification.

The chief said the weapon was a 12-gauge shotgun, legally purchased about a year ago despite the harassment case against Ramos. Authorities said he also carried smoke grenades.

Ramos apparently held a grudge against the Capital Gazette's journalists over its 2011 coverage of his harassment of a woman. He filed a defamation suit against the paper in 2012 that was thrown out as groundless.

He so routinely sent profanity-laced tweets about the paper and its writers that retired publisher Tom Marquardt said he called police in 2013, telling his wife at the time, "This guy could really hurt us."

The police chief said the newspaper didn't press charges at the time because "there was a fear that doing so would exacerbate an already flammable situation."

In 2015, Ramos tweeted that he would like to see the paper stop publishing, but "it would be nicer" to see two of its journalists "cease breathing."

The online grudge apparently "went dark" for a period until some new posts just before the killings, Altomare said. But the chief said police were not aware of Ramos' more recent online activity until after the rampage, saying: "Should we have been? In a perfect world, sure, we should have been."

Investigators were reviewing Ramos' social media postings and searching his apartment in Laurel, Maryland. Altomare said authorities found evidence at the apartment of the planning Ramos put into the attack, but gave no details.

Those killed included Rob Hiaasen, 59, the paper's assistant managing editor and brother of novelist Carl Hiaasen. Also slain were editorial page editor Gerald Fischman, special projects editor Wendi Winters, reporter John McNamara and sales assistant Rebecca Smith.

The newspaper said two other employees were treated for minor injuries.

The city of Annapolis announced a vigil for the victims Friday night at a public square near the Capitol.

More From Laramie Live