Twitter has an on-going issue with security and even the social network's most-followed account isn't immune. On Tuesday the Twitter account of popstar Katy Perry was compromised with a Romanian hacker sending racist and insulting messages, including one to Perry's rival Taylor Swift.

The account has since been restored and the offending tweets deleted, though they have been preserved online by other Twitter users. The person claiming responsibility for the attacks is another Twitter user going by the name Sway, who is based in Romania.

Katy Perry Twitter Hacked Katy Perry, seen here on stage at the amfAR's 23rd Cinema Against AIDS Gala on May 19, 2016 in Cap d'Antibes, France, has had her Twitter account hacked, with insulting and racist messages posted to her almost 90 million followers. Photo: Andreas Rentz/Getty Images

The hacker's first message on the compromised account said: "haha follow @sw4ylol #hackersgonnahack." This was followed by a series of messages using foul and racist language. One of the most controversial tweets sent on the compromised account was: "Miss u baby @taylorswift." The popstars have been involved in a high profile dispute over the course of the last two years related to accusations that Perry stole some backing dancers from Swift's entourage.

It is unclear how Perry's account was compromised by a screenshot of an email sent by Twitter to reset the account's password, which suggests that Perry's email account may also have been affected. Sway also posted a link to a song on SoundCloud which has since been removed, with an email from SoundCloud saying it was removed for containing content owned by Perry.

The hacker had been running a poll on his own Twitter account asking if he should post more content, but that poll has now been deleted.

While the attack on Perry's Twitter account may be the most high profile to date, multiple other celebrities have seen their accounts hacked in the past, including Justin Bieber and Britney Spears, despite Twitter looking to improve the security of its users with the introduction of features like two-factor authentication.