A Maryland man charged with five counts of murder after allegedly opening fire on a local newspaper, had a long-running dispute with the publication.

Officials charged 38-year-old Jarrod Ramos after he was taken into custody in the aftermath of the attack on the Capital Gazette, one of the country’s oldest newspaper and located in the city if Annapolis. His first court appearance took place on Friday where he ordered held without bail.

Four reporters and a sales assistant at the paper were killed in the attack after Mr Ramos allegedly entered the office and opened fire with a shotgun some time after 3pm on Thursday. One of the journalists, Phil Davis, a crime reporter, posted a series of tweets, explaining how he and others were in their office when the suspected shooter entered and opened fire.

“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.

“Gunman shot through the glass door to the office and opened fire on multiple employees. Can't say much more and don't want to declare anyone dead, but it's bad.”

Reuters said on Friday that while authorities have not released the identity of the suspect, online court records showed a man by the same name was charged with five counts of murder.

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

Mr Ramos had a long-standing grudge against the newspaper, and unsuccessfully sued for defamation in 2012, court records showed.

He had previously made “general threats” against the community newspaper company over social media, including some as recent Thursday, said William Krampf, Anne Arundel County’s acting police chief. The threats “indicated violence,” Mr Krampf said.

The news agency said that Mr Ramos is accused of entering the Capital Gazette office on Thursday afternoon and opening fire through a glass door, hunting for victims and spraying the newsroom with gunfire as reporters hid under their desks and begged for help on social media, police and witnesses said.

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

Rob Hiaasen, 59, Wendi Winters, 65, Rebecca Smith, 34, Gerald Fischman, 61, and John McNamara were shot and killed. All were journalists except for Ms Smith who was a recently employed sales assistant, said Mr Krampf.

The Capital newspaper, part of the Gazette group, published an edition on Friday with photographs of each of the victims and a headline “5 shot dead at The Capital” on its front page.

The newspaper's editors left the editorial page blank with a note saying that they were speechless.

Mr Ramos brought a defamation lawsuit in 2012 against Eric Hartley, a former staff writer and columnist with Capital Gazette, and Thomas Marquardt, then its editor and publisher, a court filing showed. Neither Mr Hartley or Mr Marquardt are still employed by the paper.

An article by Mr Hartley had contended that Mr Ramos had harassed a woman on Facebook and that he had pleaded guilty to criminal harassment, according to a legal document.

The court agreed the article was accurate and based on public records, the document showed. In 2015 Maryland's second-highest court upheld the ruling, rejecting Ramos's suit.

Mr Ramos tweeted at the time that he had set up a Twitter account to defend himself, and wrote in his biographical notes that he was suing people in Anne Arundel County and “making corpses of corrupt careers and corporate entities”.

According to a WBAL-TV reporter who said she spoke with the woman, Mr Ramos had harassed and became “fixated” with her for no apparent reason, causing her to move three times, change her name, and sleep with a gun, Reuters said.

Capital Gazette runs several newspapers out of its Annapolis office. They include one of the oldest newspapers in the United States, The Gazette, which traces its origins back to 1727.