David Levin, 31, of Estero, Florida will spend 20 days in prison after hacking two websites belonging to the Florida state elections department.

Levin, indicted on three hacking-related charges, pleaded guilty after turning himself in, in early May. A judge in Fort Myers, Florida, sentenced him on Tuesday, September 6.

The security researcher, who is also the owner of Vanguard Cybersecurity, will serve his prison sentence during the weekends so he can attend law school during the week. He also received two years of probation.

A YouTube video led to his arrest

The reason the police started investigating Levin's case was that they received a tip from the Lee County Elections Department at the end of January, after state officials saw the YouTube video.

Levin recorded the video with Dan Sinclair, a candidate at the time in the local election’s supervisor race, revealing how easily he hacked the Lee County Elections website.

Police searched his home in February and seized his computers as evidence. Levin confessed to police, revealing that, on December 19, 2015, he illegally accessed the Lee County Elections website, and then on January 4 and 31, 2016, he gained access to the Department the State Elections website as well.

Levin informed authorities of his actions after the hacks

The cyber-security expert says he forwarded a report to the Florida Department of Elections about the issues he discovered in their websites.

Police charged Levin regardless because he didn't ask for permission before performing the hacks. Levin also used credentials he found on one of the websites to access the account of then current Supervisor of Elections, Sharon Harrington. Most of today's bug bounty programs deter security researchers from testing user credentials, since this constitutes a crime in the US.

In court, Levin described the whole incident as a "political stunt," according to Wink News, a Florida news site. Sinclair, the person with whom Levin appears in the video detailing the hack, lost the election bid.