A fifth grader in a school uniform sat in a youth courtroom last week and pleaded guilty to hacking websites of organizations including the Montreal police and the Quebec Institute of Public Health, saying he was egged on by the promise of video games.

QMI Agency reported the 12-year-0ld Montreal boy, whose name is protected by a publication ban, gave information from hacked websites to the hacktivist group Anonymous in 2012. He didn't have political motivations, his lawyer told the court, but Anonymous gave him video games for his information in illicit trades.

The boy, who arrived in court with his dad on Thursday, is said to have caused about $60,000 in damage hacking several websites, including Canadian government sites and the Chilean government, QMI Agency reported. He used hacks that denied service to visitors, changed home pages and accessed server data, sharing his techniques with others.

[ Related: Twitter hoax pretended to expose hateful message from PM ]

His sentencing hearing is next month.

Another young Montreal hacker known as Mafiaboy who attacked websites including CNN, Amazon and Yahoo! in 2000, when he was 15, received an eight-month sentence in youth detention. Eight years later, the young man behind the username Mafiaboy, Michael Calce, published a book about his crimes. He told ITBusiness.ca he was working as a security consultant, trying to turn the skills he used in those malicious attacks into a force for online protection.