The Saudi government relied on an employee inside Twitter and deployed droves of hired trolls to harass and suppress dissident Jamal Khashoggi and other critics, the New York Times reported.

Crown Prince Mohammed bin Salman and his advisers led the effort to snuff out Khashoggi’s voice and other critics, and one of their weapons was a Saudi employee inside Twitter TWTR, +1.62% who had access to user account information, the Times reported, citing anonymous sources. Western intelligence officials suspect the employee spied on user accounts to aid the Saudi government, according to the Times.

Executives at Twitter were aware of a scheme by the Saudis to gain access to account information as far back as 2015, the Times reported. That’s when intelligence officials told them the Saudis were “grooming” an employee to spy on dissidents’ accounts.

A spokesman for Twitter declined to comment to the Times.

Saudi authorities confirmed Friday that Khashoggi died after a confrontation inside its consulate in Istanbul. In his final column, Khashoggi lamented that Arab governments have been “given free rein to continue silencing the media at an increasing rate.”

The consulting giant McKinsey & Co. played a role, too, according to the Times, by helping the Saudi government analyze public perception of economic austerity measures announced in 2015. The consulting firm submitted a report pinpointing exactly who was leading the conversation about the measures on Twitter. The government then arrested one of the people named in the McKinsey report, according to the Times.

A spokesperson for McKinsey told MarketWatch: “We were never commissioned by any authority in Saudi Arabia to prepare a report of any kind or in any form to identify critics. In our work with governments, McKinsey has not and never would engage in any work that seeks to target individuals based on their views,” said the spokesperson, who declined to be named.

They added, “The document in question was a brief overview of publicly available information looking at social media usage. It was not prepared for any government entity. Its intended primary audience was internal. We are horrified by the possibility, however remote, that it could have been misused in any way. At this point, we have seen no evidence to suggest that it was misused, but we are urgently investigating how and with whom the document was shared.”