The official Twitter account of the UK Government in Wales has been used to post pornography.
The graphic video clip was shared in the early afternoon.
An official told the BBC that the matter was quickly detected and the explicit imagery taken down within “moments”.
He added that the cause had been a “cyber-attack” rather than an accidental post by the social media team, as some had speculated.
A message apologising for any offence caused has since been tweeted.
“We are confident the issue has now been resolved,” it added.
The spokesman declined to disclose how the account was compromised.
The post was in the form of a retweet, which had asked viewers to rate an attached video clip from one to 10 in return for the promise of further material via a direct message.
The account is used to represent “the face of the UK government in Wales” and is followed by more than 14,500 others.
Several noticed the mishap, including members of the press who keep an eye on its activity as part of their jobs.
“After all of the profile account hijacking, it’s surprising that a government account can still be taken over,” commented Prof Alan Woodward, a cyber-security expert from the University of Surrey.
“To their credit, they acted promptly and were able to re-establish control of the account rapidly. They obviously had a good incident-response plan, which is vital because these days it’s more a case of when, not if, you’ll be attacked.”
The development comes days after it emerged that a suspect has been arrested in the US in connection with the hack of Twitter chief Jack Dorsey’s own account in August.
According to the news site Motherboard, the alleged member is not being named because they are a minor.