A 38-year-old man charged with opening fire Thursday in a Maryland newsroom, killing five people and injuring two others, appeared to hold a years-long vendetta against the newspaper after it published a column about him pleading guilty to harassing a former high school classmate in 2011.

Jarrod Ramos, a resident of Laurel, Maryland, was charged Friday with five counts of first-degree murder, according to court records.

Anne Arundel County Acting Police Chief Bill Krampf said authorities believed the attack on the newspaper's offices in Annapolis was targeted and that threats had been sent to the publication through social media.

After the Capital Gazette published the column about him, Ramos sued the columnist Eric Hartley for defamation, naming Capital Gazette Communications and Tom Marquardt, the paper’s then-editor and publisher, as defendants.

The defamation suit, which was dismissed by the courts, stemmed from a July 31, 2011, story titled "Jarrod wants to be your friend" about how Ramos reached out to an old classmate on Facebook and proceeded to harass her over email, according to court documents.

"That sparked months of emails in which Ramos alternately asked for help, called her vulgar names and told her to kill herself," wrote Hartley, who is now an editor at the Virginian-Pilot. "He emailed her company and tried to get her fired. She stopped writing back and told him to stop, but he continued."

Ramos has a degree in computer engineering and worked for the US Bureau of Labor Statistics as an IT contractor from 2007 to 2014, a spokesperson for the Department of Labor confirmed to BuzzFeed News.

At the time, he had no previous criminal record.

Marquardt told the Baltimore Sun, a sister paper of the Capital, he wasn't surprised that Ramos had been identified as the suspected shooter.

He said Ramos harassed the newspaper for years after it published the 2011 article.

"I was seriously concerned he would threaten us with physical violence," Marquardt told the Sun, adding that he reached out to Anne Arundel County authorities about Ramos years ago, but nothing came of it.

He also considered filing a restraining order but decided against it.

"I remember telling our attorneys, 'This is a guy who is going to come in and shoot us,'" Marquardt said.

In November 2011, Ramos appeared to create a Twitter account that he used to attack Hartley, Marquardt, and the newspaper.