BOSTON (Reuters) - New Hampshire's first-in-the-nation U.S. presidential nominating primary has long drawn activists from around New England who travel into the state to support candidates in rallies and door-to-door visits with voters.

But one Massachusetts man went a step further, traveling to the neighboring state to illegally cast a vote in the elections that set President Barack Obama on course for the White House.

The man, Lorin Schneider, pleaded guilty on Monday in state court in Manchester, New Hampshire, to illegally voting in the 2008 and 2012 presidential primaries, both misdemeanor charges, and to voting in the 2012 presidential election, a felony.

Schneider was given a suspended sentence of one to three years in state prison that he can avoid with five years of good behavior, and ordered to pay a $5,000 fine plus a 24 percent penalty.

Schneider, a registered Democrat, grew up in Manchester but moved out of the state about two decades ago. He now lives in Carver, Massachusetts.

It was the first time prosecutors have found an out-of-state voter casting a ballot in the widely watched primary.

"This is the first one I've prosecuted and I'm not aware of any others," said Stephen LaBonte, assistant attorney general.

"He continued to vote using his old address," LaBonte said.

Schneider's attorney, Jim Rosenberg, said his client had cooperated with the state attorney general's office throughout the process.

"He fully and completely and cooperatively spoke with them," Rosenberg said. "He was forthcoming and it's primarily information that he provided that the state relied upon."

(Reporting by Scott Malone; Editing by Jim Loney and Will Dunham)