HUNTINGTON BEACH, Calif. (AP/CBS13) — A Calaveras County man who poisoned eight homeless people in Huntington Beach so he could videotape their reactions was sentenced Friday to four years in state prison.

William Cable, 38, of San Andreas, was sentenced after pleading guilty to poisoning, injuring an elderly person, and other felony and misdemeanor charges, according to the Orange County district attorney’s office.

READ MORE: 'He Gives Me Everything To Be': Therapy Dog For Woman In Wheelchair Now Needs Wheelchair Of His Own

Prosecutors said that last May, Cable gave homeless people in Huntington Beach food laced with oleoresin capsicum, which officials described as being twice as strong as pepper spray used by police.

Some victims were told they were participating in a “spicy food challenge” and others were not, authorities said. Some were given other food and beer to get them to eat the poisoned food.

READ MORE: Quake Near Truckee: Why Some Got Shake Alerts And Others Didn't

The victims had seizure-like symptoms, difficulty breathing and suffered vomiting and intense mouth and stomach pain. Some had to be hospitalized, prosecutors said.

“They were exploited and poisoned as part of a twisted form of entertainment, and their pain was recorded so that it could be relived by their attacker over and over again,” Orange County District Attorney Todd Spitzer said in June after Cable was criminally charged.

MORE NEWS: Sacramento Police Officer Justin Shepard Arrested For Alleged Domestic Violence Incident

Cable could have faced more than 19 years in prison if he had been convicted at trial.