He just really wanted to win.

Matthew Weaver, a junior at California State University, San Marcos near San Diego, was sentenced Monday to a year in prison after he pleaded guilty to stealing login information from hundreds of classmates so he could cast phony votes to elect himself class president.

This is the story of a 22-year-old business major who hacked into his school’s computers, stole classmates’ usernames and passwords, and voted for himself for class president in spurts of hundreds of votes at a time.

Then he got caught, was investigated by the FBI, and was prosecuted by the federal government for identity theft. Ultimately, he entered a guilty plea on felony charges.

What did he want? Prosecutors say he was after the $8,000 stipend that the senior-class president at Cal State San Marcos receives, plus control over the $300,000 annual budget. Administrators at Cal State San Marcos declined to comment for this article.

According to court documents, Weaver’s elaborate plan to rig the election began with a 2012 PowerPoint presentation he gave to fellow members of his fraternity, Tau Kappa Epsilon. He proposed that he run as president and his fraternity brothers run as vice presidents and other officials—with each titleholder receiving an annual stipend of $1,000 to $8,000. If they won, Weaver and his brothers would control the student-government budget. (Weaver, who is in custody, was not able to comment for this article ahead of deadline.)

Apparently not confident in his ability to win the class presidency on his own, Weaver began researching how to fix the election. Investigators said browser records on his laptop showed Weaver was Googling terms like “how to set someone up for a lawsuit,” “how to rig an election,” and “invasion of privacy issues,” in the months before the voting began.

He bought 15 keyloggers—devices that can be inserted into a computer to record a person’s keystrokes, usually without their knowledge—on Amazon and had them shipped to his apartment. He installed the keyloggers on 19 public computers on the campus in January 2012, two months before the election, according to court documents.

The keyloggers recorded everything users typed, including the login names and passwords they needed to access public computers on campus.

For months, Weaver recorded the usernames and passwords into a spreadsheet he called “Fuck ASI alpha”—ASI is shorthand for Associated Students Inc., Cal State San Marcos’s student-government organization. In all, authorities said he had 740 student usernames and passwords listed on the spreadsheet.

On March 15, 2012, the last day of voting, San Marcos officials noticed some bizarre patterns. A laptop linked to a single on-campus IP address was casting huge numbers of votes for Matthew Weaver—first 150 at a time, then 33, then 259. In the end, he cast 634 votes for himself, according to court documents.

A campus police officer was dispatched to the IP address’s location, where he found Weaver sitting with his laptop in a classroom building.

Weaver claimed he was working on a school project and was arrested on the spot.

A campus surveillance video of Weaver’s last few minutes before his arrest show that he intercepted an email from a student to a university administrator, in which she complained that she was unable to vote. Weaver hacked into the student’s email, using the username and password he had collected into the Fuck ASI alpha spreadsheet and wrote back to the administrator, masquerading as the student and saying she was now able to vote. Then he deleted the conversation from the student’s inbox.

Four days after his arrest, Weaver anonymously sent a screenshot of a fake chatroom to local journalists, in an attempt to frame another student for the crime. Weaver created fake email accounts in the name of several students and then initiated a chatroom where they seemingly acknowledged smearing his reputation, according to court documents.

This week, Weaver pleaded guilty to three counts of wire fraud, unauthorized access to a computer, and identity theft, and was sentenced to 12 months in prison. He waived his right to an appeal.

His case was prosecuted federally by Laura Duffy and Sabrina Feve, U.S. attorneys who have worked on high-profile terrorism and drug trials.

Feve told The Daily Beast that Weaver got off with a below-guideline sentence—27 months has been the low end of the spectrum for federal identity-theft cases.

“I hope people understand that we didn’t take the case federally because a student election was rigged,” she says, “that’s obviously a naughty no-no, but not something most people would consider a federal crime. But identity theft is such a rampant and pervasive problem, it’s still a national priority. It’s not about us wanting to muck about in a school election. He stole the identities of 700 people and abused those credentials.”

Weaver’s attorney, John Kirby, begs to differ.

“I really don’t think his actions warranted a felony conviction,” Kirby, a former prosecutor, says. “The prosecutor on this case is from the national security section of the U.S Attorney’s Office. We’re using those resources to nail a kid who rigged a school election. Is this really what the federal government should be spending money on?”

When asked how Weaver is feeling about his year in prison, Kirby responded, “he’s a little scared. Anyone would be.”

“Mr. Weaver is a very bright guy,” Kirby says, “and this was really, really stupid. But does it warrant having a felony conviction for the rest of his life?”