Netflix pulled an episode of Hasan Minhaj's "Patriot Act" in Saudi Arabia that was critical of the kingdom and accused it of covering up the killing of the journalist Jamal Khashoggi to protect its crown prince.

The episode mocked the kingdom's changing account of the journalist's death and accused it of lying to protect its crown prince's international reputation.

Netflix told the Financial Times that it received a legal complaint from the kingdom, which said the episode violated its cybercrime law.

Khashoggi's editor at The Washington Post said it was "outrageous" that Netflix pulled the episode.

Netflix removed an episode of a comedy show that was critical of Saudi Arabia and accused the country of covering up the killing of the journalist Jamal Khashoggi to protect its crown prince.

The episode of Hasan Minhaj's "Patriot Act" that was removed from Saudi Arabia criticized Crown Prince Mohammed bin Salman and cast doubt on Saudi Arabia's efforts to distance itself from the death of Khashoggi, who was killed in the Saudi Consulate in Istanbul in October.

Minhaj mocked Saudi Arabia's changing account of Khashoggi's death in the episode and said the country's evolving account of its leaders' involvement in the killing was designed to protect Crown Prince Mohammed's international reputation as a reformer in the Middle East.

Netflix confirmed to the Financial Times that it had pulled the episode, citing a legal complaint from the kingdom.

Read more: Early data on Hasan Minhaj's 'Patriot Act' suggests it could succeed where other Netflix talk shows have failed

"This is the most unbelievable cover story since Blake Shelton won sexiest man alive. Are you kidding me?" Minhaj, a Muslim-American comedian, said.

"This entire cover-up exists for one reason," Minhaj said, before the show cut to clips of news reporters citing analysts who suggested that the kingdom's changing story was designed to protect the crown prince.

Saudi Arabia initially claimed that Khashoggi safely left the consulate and said allegations he was killed were "baseless." After changing its story several times, it now maintains that the death was the fault of a rogue Saudi government operation.

"The Saudis were struggling to explain his disappearance: They said he left the consulate safely then they used a body double to make it seem like he was alive," Minhaj said.

"At one point they were saying he died in a fistfight, Jackie Chan-style. They went through so many explanations. The only one they didn't say was that Khashoggi died in a free-solo rock-climbing accident."

While the kingdom's account of what happened has changed, it has maintained that the crown prince was unaware of and did not order the killing. The CIA reportedly found that the crown prince personally ordered the killing and a motion passed by the US Senate condemned the crown prince over the incident.

Read more: Here's everything we know about the troubling disappearance and death of Saudi journalist Jamal Khashoggi

The video can still be seen on the show's official YouTube channel, where it had more than 1.3 million views at the time of writing.

Minhaj also criticized the Saudi-led military campaign in Yemen and the power and wealth of the Saudi royal family.

"It blows my mind that it took the killing of a Washington Post journalist for everyone to go, 'Oh, I guess [Crown Prince bin Salman] is not a reformer," he said. "Meanwhile, every Muslim person you know was like, 'Yeah, no shit.'"

Netflix told the Financial Times that it pulled the episode after the country's Communications and Information Technology Commission requested its removal, accusing it of violating the country's cybercrime law.

"We strongly support artistic freedom worldwide and only removed this episode in Saudi Arabia after we had received a valid legal request — and to comply with local law," it said.

Netflix cited Article 6 of Saudi Law to the Financial Times, which states that "production, preparation, transmission, or storage of material impinging on public order, religious values, public morals, and privacy, through the information network or computers" is a crime that can be met with up to five years in prison and a fine of up to $800,000.

Karen Attiah, Khashoggi’s editor at The Washington Post, where he wrote columns often critical of the Saudi government, criticized Netflix's move.

" @ hasanminhaj of @ patriotact has been a strong, honest and (funny) voice challenging Saudi Arabia + Mohammed bin Salman in the wake of # khashoggi's murder," she tweeted. "He brought awareness about Yemen. Quite outrageous that @ netflix has pulled one of his episodes critical of Saudi Arabia.

"When Jamal Khashoggi wrote about the need for free expression in the Arab world (and everywhere), that freedom is not just about journalists. It's about freedom for artists, comedians, cartoonists, musicians, activists and anyone who wants to express their views on society."