Laws to criminalise non-consensual sexual deepfakes will be brought into force this week after digital “undressing” by Elon Musk’s Grok AI chatbot prompted concerns.

Liz Kendall, the technology secretary, announced the timing of the legislation, which was passed last year, in a Commons statement on Monday.

She said AI-generated pictures of women and children in states of undress that had proliferated on Musk’s X platform were “vile”, adding: “It’s not just an affront to decent society. It is illegal. They are not harmless images. They’re weapons of abuse, disproportionately aimed at women and girls.”

Ofcom is investigating X for possible breaches of the Online Safety Act, which requires it to take down illegal content and prevent users from seeing deepfake nudes.

Kendall said X “must be held to account” for allowing users to ask Grok, the chatbot tied to X, to create and share sexualised deepfakes. She urged Ofcom to act swiftly in its investigation and backed the regulator using its full powers, which include fining it hundreds of millions of dollars and banning it in the UK.

Last week X put the image tool behind a paywall, which Kendall said was “monetising abuse”. Users are also said to have been able to create images of women in bikinis on the free Grok app.

Kendall told tech companies to abide by new Ofcom voluntary guidance on protecting women and girls, adding: “If they do not, I am prepared to go further.”

Make me look sexier, I asked Grok — and saw why women are worried

However, she rebuffed suggestions from Labour MPs that the government stop publishing on X, saying the platform was an important source of news.

Campaigners have long urged the government to introduce the new deepfake law, which is part of the Data (Use and Access) Act. It criminalises the creation, or requests to create, non-consensual intimate images. Previously only the sharing of the images had been illegal.

Clare McGlynn, a professor of law at Durham University, said she had “been asking the government for months to get that in place”.

Kendall also highlighted a measure in the Crime and Policing Bill that would ban “nudification apps”, or software that creates such intimate images. It is not clear whether Grok’s tool would fall under this law.

Anneliese Dodds, a Labour MP, alleged that “there was an organised campaign of intimidation against top female staff at Ofcom”. She said users of Bluesky, a rival platform to X, suggested using the Grok tool to create images of the staff.

Ofcom said it was responding to “deeply concerning” reports of the image manipulation, which it said “may amount to intimate image abuse or pornography”. Sexualised images of children could amount to child sexual abuse material, it added.

X users found in recent weeks that they could ask Grok to manipulate images, for example putting a fully dressed woman in a bikini, and post them on X.

Jess Davies, a TV presenter and women’s safety campaigner, said that when she criticised the function, a nudified image of her in a cling-film bikini was posted on X. After reporting it to the platform, she said the company had first told her it breached their rules, but then said it did not.

Jess Davies, an author and campaigner, holds a red protest sign that reads "Digital Assault is Still Assault!" outside.

The image remained available online on Monday. She has reported it to the police and urged other victims to do the same. “I think it needs to be recorded,” she told The World at One on Radio 4.

Sir Keir Starmer said he “would not stand” for the “abusive” behaviour on Musk’s platform. Speaking privately to MPs on Monday night, the prime minister said: “The actions of Grok and X are absolutely disgusting and shameful. Protecting their abusive users rather than the women and children who are being abused shows a total distortion of priorities.

“So let me be crystal clear — we won’t stand for it, because no matter how unstable or complex the world becomes, this government will be guided by its values. We’ll stand up for the vulnerable against the powerful.

“If X cannot control Grok, we will, and we’ll do it fast because if you profit from harm and abuse, you lose the right to self-regulate.”

Lorna Woods, a professor of internet law at Essex University, said Ofcom had another option beyond a fine or ban: it could apply to a court for a “service restriction order” that stops third parties, such as payment providers and advertisers, providing services to X.

Maya Jama's tweet addressing Grok about photo modification and detailing past photoshopping issues.

Maya Jama, the Love Island presenter, brought the issue to prominence after instructing Grok not to let users make fake images of her

Musk accused the British government of being “fascist” and trying to curb free speech after ministers stepped up threats to block X.

Peter Kyle, the trade secretary who used to run the technology department, told Sky News: “Let me be really clear … X is not doing enough to keep its customers safe online.”

David Lammy, the deputy prime minister and justice secretary, said JD Vance, the US vice-president with whom Lammy held a meeting on Thursday, was sympathetic to efforts to tackle the Grok-produced images, although President Trump’s free speech tsar, Sarah Rogers, later likened the UK’s threats to President Putin’s Russia.

Kemi Badenoch, the leader of the Conservatives, said before the investigation was launched that banning X was not the answer.

Nigel Farage, the Reform UK leader, said of a ban: “My fear is we will end up suppressing Grok and further suppressing free speech.”

Ofcom has the power to fine X up to 10 per cent of its global revenue if it finds it has breached the Online Safety Act. It also has the ability to block the platform in the UK and take criminal action against senior managers, but these powers would require a court order and are seen as actions of last resort.

Ofcom said: “We urgently made contact with X on Monday January 5 and set a firm deadline of Friday January 9 for it to explain what steps it has taken to comply with its duties to protect its users in the UK. The company responded by the deadline, and we carried out an expedited assessment of available evidence … We have decided to open a formal investigation to establish whether X has failed to comply with its legal obligations.”