A British hacker who gained access to the Twitter and Facebook accounts of singer Selena Gomez and posted Justin Bieber sucks! to the accounts has been jailed for a year.

Gareth Crosskey, 21, gained access to accounts belonging to Selena Gomez, the boyfriend of fellow pop sensation Justin Bieber, in January by pretending to be Selena's stepfather, according to the Daily Mail.

Crosskey also viewed Selena Gomez's personal information stored online and attempted to sell the nuggets to the media, the New York Daily News reported.

On Selena Gomez's Twitter page, Crosskey wrote Oh yeh, JUSTIN BIEBER SUCKS!!!!!!!!!, enraging the 19-year-old entertainer's loyal followers, which number more than 11 million on Twitter.

It took Gomez's handlers about three days to gain control of her online accounts and British and U.S. authorities spent 50,000 pounds investigating the crime, the Daily Mail reported.

Crosskey, a former McDonald's employee, posted the same message on Selena Gomez's Facebook page.

Crosskey apologized for his behavior and enrolled in a college course designing computer games, according to his attorney, Gareth Morgan.

He accepts his actions have caused distress and alarm and he accepts that his actions were stupid, Morgan said of Crosskey, as reported by The Sun.

The 21-year-old also read private messages between Justin Bieber and Selena Gomez and told Selena's stepfather he hacked into four of his stepdaughter's email accounts, according to the Daily Mail.

Crosskey pleaded guilty last week to the UK's Computer Misuse Act and was subsequently jailed for 12 months, according to the Associated Press.

Southwark Crown Court Judge John Price admonished Crosskey for his behavior.

You are clever with a computer and you hacked into the private part of somebody's Facebook account -- that somebody was a singer, a celebrity called Selena Gomez, the judge told Crosskey, according to the Daily Mail. People deserve privacy and should not [have] their private correspondence by email made public. People are entitles [sic] to privacy, even those who seek publicity.

The romance between Bieber and Gomez is one of the most talked about celebrity relationships, as both singers have loyal fan bases.

Their relationship raised eyebrows in February 2011 during the Vanity Fair Oscar party, when Bieber and Gomez attended as a couple.