The Maryland police have detained a 38-year-old man allegedly responsible for in one of the deadliest attacks on the media in America. The suspect, Jarrod Ramos, who was armed with a shotgun and smoke grenades, stormed into the newsroom of The Capital Gazette newspaper chain’s Annapolis office and opened fire, killing five people and injuring two others.

The police are questioning Ramos. The shooting has been described as a “targeted attack” by the police.

The incident prompted law enforcement agencies to provide protection at the headquarters of all American media organisations.

Jarrod Ramos had a long history of conflict with the daily, which produces a number of local newspapers along Maryland’s shore.

He lost a defamation case against the paper in 2015 over a 2011 column he contended defamed him. The column provided an account of Ramos’s guilty plea to criminal harassment of a woman over social media.

READ | 5 killed in shooting at The Capital Gazette newspaper office, police call it ‘targeted attack’

“This was a targeted attack on The Capital Gazette. This person was prepared today to come in. He was prepared to shoot people,” Anne Arundel County Deputy Police Chief William Krampf told reporters at a news conference.

“His intent was to cause harm,” he added.

The police said all five deceased were Capital Gazette employees. They are Gerald Fischman, Rob Hiaasen, John McNamara, Rebecca Smith and Wendi Winters.

While Fischman and Hiaasen were editors, McNamara was a reporter, Smith was a sales assistant and Winters worked for special publications, according to the newspaper’s website.

Four of them died on the spot, while the fifth person was pronounced dead at the University of Maryland Medical Centre.

The shooting began around 3 pm (local time) in the office building.

Ramos entered the building with a shotgun and looked for his victims, said the police, who reached the scene within a minute of the reported gunfire. Ramos was hiding under a desk in the newsroom when he was nabbed.

Gazette reporter Phil Davis described the scene as a “war zone” and a situation that would be “hard to describe for a while”.

After his arrest, Jarrod Ramos refused to cooperate with the authorities or provide his name, said the police. He was identified using facial recognition technology, a law enforcement official told The New York Times.

The Capital Gazette, which has an editorial staff of 31 people, had a daily circulation of about 29,000 and a Sunday circulation of 34,000 as of 2014.

Commonly referred to as the Capital, the paper was founded in 1884 as the Evening Gazette.

The paper promotes itself as one of the oldest publishers in the country, with roots dating to the Maryland Gazette in 1727.

President Donald Trump tweeted: “My thoughts and prayers are with the victims and their families.”

Deputy Press Secretary Lindsay Walters said the White House had been in touch with the FBI.

“Our thoughts and prayers go out to those affected by the horrible shooting at the Capital Gazette newspaper in Annapolis, Maryland. We are grateful to the first responders who are on the scene,” she said.

Asked about Trump’s criticism of the press corps, she said the President and his staff did not believe violence was acceptable in any situation, adding that “we stand by that”.

House Speaker Paul Ryan said: “The senseless attack on a Maryland newspaper today is sickening. God bless these journalists. We pray for them and their families tonight.”

Joel Simon, Executive Director of the Committee to Protect Journalists, said violence against journalists was unacceptable.

“Newspapers like the Gazette do vital work, and our thoughts are with them amid this unconscionable tragedy,” he added.

Asserting that reporters should not have to hide from gunfire while doing their jobs, former Congresswoman Gabrielle Giffords, founder of the gun violence prevention organisation, said time and time again, those in the Congress had failed to show the courage needed to keep people safe.

“Americans are demanding that their lawmakers pass effective laws that can protect our communities and stop dangerous people from accessing guns, but this Congress refuses to listen. We should be outraged. And we should be making plans to hold them accountable,” she said.

Media watchdog, Reporters Without Borders (RSF) said it was deeply disturbed to learn that a shooting at the Capital Gazette, had resulted in the death of five people.

“Is what happened in the Capital Gazette newsroom in Annapolis, Maryland, the equivalent of the Charlie Hebdo killing or of the last bombing against journalists in Kabul?” said RSF Secretary general Christophe Deloire.

In any case, this is a new tragedy for journalism, which is the victim of increasing violence globally, even in democracies, he said.

“It is deeply saddening to learn of this shooting happening in a local newsroom in the US. RSF strongly condemns this act of violence, and any such acts against journalists,” Deloire added.

“We expect a quick and thorough investigation into this tragedy,” said Margaux Ewen, Director of RSF’s North America bureau.

Indian-American Congressman Ro Khanna demanded that the Congress act now on gun violence.

“Yet another tragedy in Annapolis and it won’t be the last unless we do something. Far too many people are hiding in closets, under their desks, in their places of work, worship, and in schools. This must stop,” he said.

“My heart is with The Capital Gazette and all the victims and families affected,” Khanna said.

Boston Police said that it had increased patrols near local media outlets.

“While there are no credible concerns or information detailing similar threats directed towards media outlets in Boston, Commissioner Evans has called for increased and directed patrols in and around various media agencies throughout the city,” a police spokesman told the local Boston Globe.

Similar measures have been taken by the New York Police Department including posting police officers outside ‘The New York Times’ office.

“The NYPD has deployed counterterrorism teams to media organisations in and around New York City. These deployments are not based on specific threat information, but rather out of an abundance of caution until we learn more about the suspect and motives behind the Maryland shooting,” said John Miller, Deputy Commissioner for Counterterrorism and Intelligence at the NYPD.

“It has become a standard practice to shift resources strategically during active shooter or terrorist events,” he said.

(With agency inputs)