Two days before Thursday's shooting at the Capital Gazette newsroom, Milo Yiannopoulos had told an Observer journalist "I can't wait for the vigilante squads to start gunning journalists down on sight."

Five people were killed and several more were injured Thursday at the Maryland newsroom.

Yiannopoulos has since defended his message as a joke while further criticizing the media.

Milo Yiannopoulos encouraged vigilantes to start "gunning journalists down" just two days before a Maryland newspaper was targeted in a shooting that killed five people.

Yiannopoulos, the prominent right-wing figure who used to work as a senior editor at the far-right news website Breitbart, told the US news website Observer over text message: "I can't wait for the vigilante squads to start gunning journalists down on sight."

He was responding to a request about a longer feature about a restaurant he is said to frequent, according to the outlet. When asked to elaborate by the Observer, Yiannopoulos said the statement was his "standard response to a request for comment."

Authorities said five people were killed and several more were "gravely injured" in the shooting Thursday afternoon at the Capital Gazette's newsroom in Annapolis, Maryland.

The acting police chief William Krampf said it was a "targeted attack." The suspect filed a defamation lawsuit against the company in 2012, which he lost. Several of those killed had decades of experience in journalism.

Yiannopoulos seemed to preemptively criticize journalists who would draw a connection between comments like his and the shooting. In a post on his Facebook page, he accused the media of trying to score "political points" and claimed that the message had been a "joke."

"I regret nothing I said, though of course like any normal person I am saddened to hear of needless death," he said.

"I sent a troll about 'vigilante death squads' as a *private* response to a few hostile journalists who were asking me for comment, basically as a way of saying, 'F--- off.' They then published it.

"Amazed they were pretending to take my joke as a 'threat,' I reposted these stories on Instagram to mock them — and to make it clear that I wasn't being serious."

Yiannopoulos said on Friday that thousands of tweets had accused him "of being responsible for these deaths."

He suggested that if his comments did incite the shooting, it was the fault of news organizations for publishing them. He shared an article from Dangerous.com with the headline "Did the Daily Beast and New York Observer Just Get Journalists Killed?" and added the caption "But will they take responsibility?"

It was unclear whether the suspect in the shooting was aware of Yiannopoulos' comments.

In a post on his Instagram page, Yiannopoulos suggested that he was going to sue the Observer. In screenshots of messages sent to the reporter Davis Richardson, he said: "Your life is over."