First-degree murder charges have been filed against a man who police said targeted a newspaper in Maryland, shooting his way into the newsroom and killing five people before officers swiftly arrested him.

Jarrod Warren Ramos was interrogated, charged and jailed pending a hearing in Annapolis.

Investigators said earlier that he was unco-operative.

The attack on The Capital Gazette in Annapolis came amid months of verbal and online attacks on the “fake news media” from politicians and others from President Donald Trump on down.

It prompted New York City police to immediately tighten security at news organisations in America’s media capital.

Police described Ramos as a white man in his late thirties who lives in Maryland.

Acting police chief William Krampf, of Anne Arundel County, said the gunman “looked for his victims”.

“This person was prepared today to come in, this person was prepared to shoot people,” Mr Krampf said.

The 888 Bestgate Road building in Maryland after a shooting
The 888 Bestgate Road building (Jose Luis Magana/AP)

Journalists crawled under desks and sought other hiding places as he moved about the newsroom, describing agonising minutes of terror as they heard the gunman’s footsteps and the repeated blasts of the shotgun.

Police said he was also armed with smoke grenades.

Those killed included Rob Hiaasen, 59, the paper’s assistant managing editor and brother of novelist Carl Hiaasen.

I am devastated and heartsick to confirm the loss of my wonderful brother Rob today in the mass shooting in the newsroom…

Posted by Carl Hiaasen on Thursday, June 28, 2018

Carl Hiaasen said he was “devastated and heartsick” at losing his brother, “one of the most gentle and funny people I’ve ever known”.

Also killed were Gerald Fischman, editorial page editor; features reporter Wendi Winters; reporter John McNamara, and sales assistant Rebecca Smith.

The newspaper said two other employees had non-life threatening injuries and were later released from hospital.

Phil Davis, a courts and crime reporter for the paper, tweeted that the gunman shot out the glass door to the office and fired into the newsroom, sending people scrambling under desks.

“There is nothing more terrifying than hearing multiple people get shot while you’re under your desk and then hear the gunman reload,” he wrote in a tweet.

In a later interview appearing on the paper’s online site, Mr Davis likened the newspaper office to a “war zone”.

“I’m a police reporter. I write about this stuff – not necessarily to this extent, but shootings and death – all the time,” he said.

“But as much as I’m going to try to articulate how traumatising it is to be hiding under your desk, you don’t know until you’re there and you feel helpless.”

Reporter Selene San Felice told CNN she was at her desk but ran after hearing shots, only to find a back door locked.

She then watched as a colleague was shot, adding she did not glimpse the gunman.

“I heard footsteps a couple of times,” she said.

“I was breathing really loud and was trying not to, but I couldn’t be quiet.”

The reporter recalled a June 2016 mass shooting attack on Orlando’s gay nightclub Pulse and how terrified people crouching inside had texted loved ones as dozens were killed.

She said: “And there I was sitting under a desk, texting my parents and telling them I loved them.”

Survivors said the shooting – though it seemed agonisingly long – lasted mere minutes.

Police spokesman Lt Ryan Frashure said officers arrived within about 60 seconds and took the suspected gunman into custody without an exchange of gunfire.

About 170 people were then evacuated from the building, which houses other offices, many leaving with their hands up as police and other emergency vehicles arrived.

At the White House, spokeswoman Lindsay Walters said: “There is no room for violence, and we stick by that. Violence is never tolerated in any form, no matter whom it is against.”

The president tweeted: “My thoughts and prayers are with the victims and their families. Thank you to all of the First Responders.”

Press secretary Sarah Sanders added in a tweet: “Strongly condemn the evil act of senseless violence in Annapolis, MD. A violent attack on innocent journalists doing their job is an attack on every American. Our prayers are with the victims and their friends and families.”

First responders turned the site over to investigators, who remained on the site as well as an apartment complex where the suspected gunman lived in Laurel, Maryland, searching for clues to his motives.

Maryland police officers at the scene
There was a heavy armed police presence after the incident (Jose Luis Magana/AP)

“The shooter has not been very forthcoming, so we don’t have any information yet on motive,” Anne Arundel County executive Steve Schuh said.

Ramos sued the newspaper for defamation in 2012, alleging he was harmed by an article about his conviction in a criminal harassment case.

A judge dismissed the suit, telling Ramos that he had not shown “anything that was published about you is, in fact, false”.

An appeals court later upheld the dismissal.