Image copyright Capital Gazette

Staff at a Maryland newspaper have published a Friday edition after a gunman killed five people and injured two more at the paper's office.

"We are putting out a damn paper tomorrow," tweeted Chase Cook, a Capital Gazette reporter. Staff worked in the car park to get the paper out.

The gunman, who fired through a glass door into the newsroom on Thursday with a shotgun, was arrested afterwards.

He has been charged with murder and has a bail hearing shortly.

A Capital Gazette reporter tweeted the charge sheet which shows that Jarrod Ramos was charged with five counts of first-degree murder.

The suspect is reported to have unsuccessfully sued the newspaper group in 2012 for defamation.

The paper tweeted the front page of their Friday paper as well as obituaries of their colleagues.

How did the attack happen?

First reports of the shooting came at 14:40 local time (18:40 GMT) on Thursday.

Journalists inside the building posted on social media as the gunman fired through the glass door of the office with a shotgun and shot at staff inside.

An intern at the paper, Anthony Messenger, tweeted as the attacker opened fire.

Fellow staff member Selene San Felice told CNN her first reaction to the shooting had been to lie down under her desk. She tried to get out through a rear door but it was locked.

Crime reporter Phil Davis was also in the building and told The Baltimore Sun - part of the same media group as the Gazette - that he and his colleagues had hidden under their desks.

Image copyright AFP Image caption Capital Gazette reporters were pictured working on the next day's newspaper from the car park

"I don't know why he stopped [shooting]," he told the paper.

He described the scene as "like a war zone" and tweeted about his experiences as he waited to be interviewed by police.

County executive Steve Schuh told CNN the suspect had been hiding under a desk in the building when police officers arrived "within 60 seconds" of receiving news of the incident. There was "no exchange of fire", he added.

"This was a targeted attack on the Capital Gazette," said William Krampf, deputy chief of Anne Arundel County Police. He added that the gunman had "entered the building with a shotgun and looked for his victims as he walked through the lower level".

Media playback is unsupported on your device Media caption Police describe how the shooting at the newspaper office ended

Speaking to reporters, Mr Krampf said an item "we believed to be an explosive device" had been found at the premises and destroyed. It turned out to be a smoke bomb, he said

Police say they safely evacuated 170 people from the building, which housed 30 other businesses.

Who are the victims?

The authorities have named the dead as:

Wendi Winters, 65, editor and community reporter

Rebecca Smith, 34, sales assistant

Robert Hiaasen, 59, assistant editor and columnist

Gerald Fischman, 61, editorial writer

John McNamara, 56, reporter and editor

The Committee to Protect Journalists tweeted that before the Maryland shooting, seven journalists had been killed in the US in relation to their work since 1992.

Most recently, TV reporter Alison Parker and cameraman Adam Ward were killed in 2015 during an interview in Moneta, Virginia.

Read more about US gun violence

Media playback is unsupported on your device Media caption After the Las Vegas attack in October 2017 the BBC looked at how US mass shootings are getting worse

Image copyright Anne Arundel Police/Handout via REUTERS Image caption The shooting suspect, Jarrod Ramos

Who is the suspect?

The Gazette reportedly wrote an article in 2011 about a woman who said Jarrod Ramos was stalking her, and he failed in his attempts to sue the paper for defamation the following year.

Police did not ascribe any motive after arresting him following Thursday's attack.

Ramos is scheduled for a bail hearing on Friday morning in Annapolis.

What reaction was there to the attack?

Federal agencies, including the FBI and the Bureau of Alcohol, Tobacco, Firearms and Explosives, were involved in the response to the attack.

Maryland governor Larry Hogan said on Twitter he was "absolutely devastated" and was in contact with authorities.

President Donald Trump tweeted that his "thoughts and prayers" were with the victims and their families.

White House Press Secretary Sarah Sanders later condemned the attack on "innocent journalists doing their job".

The New York City Police Department (NYPD) said it had deployed counterterrorism teams to media organisations in and around New York City as a precaution.

Mayor of Annapolis Gavin Buckley told the Guardian he could not understand how the paper "could make someone that hostile".

"If this is an attack on journalism it is a sad state of affairs," he said. "Because journalists, you don't get paid enough to put your life on the line, we're not in some war zone, we're not in some third-world country with a dictator."

Democratic senator Chris Van Hollen responded to a Gazette reporter on Twitter.

Writer and alt-right figure Milo Yiannopoulos has faced criticism online for writing that he "can't wait for the vigilante squads to start gunning journalists down".

Mr Yiannopoulos has defended himself on Facebook, saying the message was "a troll".