The man suspected of shooting five people dead in a Maryland newspaper office was “there to kill as many people as he could kill”, police say.

Jarrod Ramos was ordered on Friday to be held without bail a day after the mass shooting at the Capital Gazette in Annapolis. Officials say the alleged attacker had barricaded the back doors of the newspaper before entering and opening fire with a shotgun. He had legally bought the weapon – a pump-action model.

“The fellow was there to kill as many people as he could kill,” Timothy Altomare, chief of the Anne Arundel County Police, told reporters on Friday.

Annapolis shooting: 'Multiple casualties' at Capital Gazette newspaper building in Maryland

At a bail hearing, the court was told the attack had been well planned. Prosecutor Wes Adams said that having barricaded the back of the community newspaper, Mr Ramos had entered through the front, aiming and shooting at people. The court was told that at least one of the five victims had been killed as they sought to escape from the rear of the offices.

Reuters said Mr Ramos was “uncooperative” with his interrogators and in court papers, authorities described him as “recalcitrant”. Appearing by video before he was denied bail, he appeared to watch attentively but never spoke. His public defenders had no immediate comment outside court.

Mr Adams said the judge’s finding that Mr Ramos was a danger to society was justified because of evidence that he carefully planned the attack and used “a tactical approach in hunting down and shooting innocent victims”.

Maryland shooting: Capital Gazette newspaper staff targeted Show all 10 1 /10 Maryland shooting: Capital Gazette newspaper staff targeted Maryland shooting: Capital Gazette newspaper staff targeted Police respond to the shooting in Annapolis, AFP/Getty Images Maryland shooting: Capital Gazette newspaper staff targeted Pat Furgurson, staff reporter of the Capital Gazette, reports outside the scene of a shooting EPA/JAY FLEMING Maryland shooting: Capital Gazette newspaper staff targeted Police and first responders attend the scebe EPA Maryland shooting: Capital Gazette newspaper staff targeted A member of the FBI responds to the shooting in Annapoli AFP/Getty Images Maryland shooting: Capital Gazette newspaper staff targeted Authorities work at the scene AP Maryland shooting: Capital Gazette newspaper staff targeted Emergency personnel outside the Capital-Gazette newspaper Getty Images Maryland shooting: Capital Gazette newspaper staff targeted Capital Gazette reporter Chase Cook, right, and photographer Joshua McKerrow, left, work on the next days newspaper while awaiting news from their colleagues. AFP/Getty Images Maryland shooting: Capital Gazette newspaper staff targeted Police respond to a shooting in Annapolis, Maryland, June 28, 2018. At least five people were killed Thursday when a gunman opened fire inside the offices of the Capital Gazette, a newspaper published in Annapolis, a historic city an hour east of Washington.A reporter for the daily, Phil Davis, tweeted that a "gunman shot through the glass door to the office and opened fire on multiple employees.""There is nothing more terrifying than hearing multiple people get shot while you're under your desk and then hear the gunman reload," Davis said. / AFP PHOTO / SAUL LOEBSAUL LOEB/AFP/Getty Images SAUL LOEB AFP/Getty Images Maryland shooting: Capital Gazette newspaper staff targeted "This was a targeted attack on the Capital Gazette," William Krampf, the Anne Arundel County acting police chief, said Thursday evening during a press conference, referring ot the joint name that appears at the office to describe the two papers that work inside. "This person was prepared today to come in. This person was prepared to shoot people. His intent was to cause harm, and as I've stated before, the investigative part of this is going to be thorough, and it's going to take some time," EPA Maryland shooting: Capital Gazette newspaper staff targeted Police secure the scene AP

Those killed were Rob Hiaasen, 59, the paper’s assistant managing editor and brother of novelist Carl Hiaasen. 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 editorial page editor Gerald Fischman, special projects editor Wendi Winters, reporter John McNamara and sales assistant Rebecca Smith.

Phil Davis, the courts and crime reporter, told his newspaper that the newsroom had become 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.”

Police said surveillance video recorded the attack, which began with a shotgun blast that shattered the glass entrance to the open newsroom. Journalists crawled under desks and sought other hiding places, describing agonising minutes of terror as they heard his footsteps and the repeated blasts of the weapon.

Officers swiftly responded and arrested him without firing a shot, police said. They recovered a gun and said he also carried smoke grenades. Some 300 local, state and federal officers converged on the scene, Mr Altomare said.

The newspaper’s offices remained surrounded by police tape and squad cars on Friday, 24 hours after the shooting rocked the quiet, suburban neighbourhood. While Capital Gazette reporters continued with their jobs – the paper put out an issue that same morning – witnesses who were in other, adjoining offices during the shooting arrived to collect the cars they left behind in the chaos.

One local resident, Laura Masters, told The Independent she was in the building for a doctor’s appointment on Thursday when she started to smell smoke. She said the air became hazy – probably from the smoke bombs police say the shooter used in his attack – and patients became agitated. Ms Masters said that’s when someone barged into the office yelling that there was a shooter in the building.

Ms Masters said she was desperately scanning for an escape route for herself and her two children, ages 6 and 19, when a SWAT team arrived “like a miracle”. Still emotional, she described the officers leading her family outside the building, their arms above their heads.

Capital Gazette offices seen the day after the shooting (Emily Shugerman/The Independent)

Along with the doctor’s office, the Gazette shares its squat, brick building with 30 other businesses, including orthodontists and lawyers. But police said the shooting was a “targeted attack” on the newspaper, where Mr Ramos reportedly had a well-documented history of harassing members of the staff.

Mr Ramos’s grievances against the paper apparently began with a 2011 column about the 38-year-old pleading guilty to harassing a woman. He filed a defamation suit against the paper in 2012 that was thrown out as groundless, and he often railed against its staff members in profanity-laced tweets.

Mr Ramos so routinely sent harassing 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.”

But the police chief said that officers were told at the time that the newspaper did not want to further inflame him by pressing charges.

In 2015, Mr 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”.

Investigators were reviewing his social media postings and searching his apartment in Laurel, Maryland, for clues to the violence.