Officials on Friday charged a man who they say opened fire with a shotgun inside an Annapolis, Maryland, newsroom, killing five people in what police called a "targeted attack."

The suspect, Jarrod Ramos, had sued the Capital Gazette newspaper six years ago and lost. The 38-year-old was charged with five counts of first-degree murder, according to Maryland court documents. His bail hearing will be held at 10:30 a.m. ET at Annapolis District Courthouse.

Jarrod Ramos

Anthony Messenger, a Capital Gazette intern, said in an interview on "Today" that he first heard pops he thought were fireworks, but soon realized someone was firing inside the newsroom. He and another co-worker tried to exit through a backdoor but found it jammed.

"I quickly realized this was a malicious situation," Messenger said.

He and his colleague slipped under a desk in the back of the newsroom. They called 911, but were not able to speak because they didn't want to alert the gunman to their location. The colleague ended up using Messenger's phone to tweet that there was an active shooter and "please help us."

Messenger said he never got a look at the gunman before he left the building.

"Unfortunately we had to pass two bodies of our colleagues, which was something that nobody should ever have to stomach," Messenger said. "It's just unfortunate that somebody would come into a place that only reports truthful stories that are fact-based and unleash hell on the office."

The five killed were identified as Wendi Winters, Rebecca Smith, Robert Hiaasen, Gerald Fischman and John McNamara.

"This person was prepared to shoot people. His intent was to cause harm," Bill Krampf, deputy police chief of Anne Arundel County, said at a news conference Thursday night. Two people suffered superficial wounds, possibly from broken glass, he added.

Ramos, who is from Maryland, sued the Capital Gazette for defamation in 2012 after a columnist wrote about his guilty plea to criminal harassment in 2011. His case was dismissed, and an appeals court affirmed the decision.

Police were notified about an active shooter at the newspaper around 2:40 p.m. and arrived to the scene within 30 seconds, authorities said. The gunman also had smoke grenades that he used when he entered the building, Krampf said. Earlier, he had identified the grenades as a "possible explosive device."

Anne Arundel County Police Lt. Ryan Frashure said there was no exchange of gunfire between the gunman and police.

The Baltimore Sun said police had also been sent to its headquarters as a precaution. The Capital Gazette is one of the oldest publishers in the country, starting in 1727 with the Maryland Gazette.

Aerial video showed people leaving the building with their hands up and a heavy police presence.

The victims were shot on the first floor of the building, Krampf said.

"He entered the building with a shotgun and he looked for his victims" inside, he said, adding that he did not know whether they were specifically targeted.