The High Court in Glasgow heard that 21-year-old Andrew McBride conducted a five-year internet campaign on Facebook and Skype.
He befriended his victims but then turned nasty and demanded some of them perform sexual acts on webcam or he would download indecent images of them.
Some of his victims were so distraught that they contemplated killing themselves.
Yesterday, judge Lord Turnbull told McBride, a social sciences student, that his behaviour was “manipulative and cruel” and added: “Your victims were humiliated to provide you with sexual images of themselves for your sexual gratification.”
He sentenced McBride, from Prestwick, to 53 months and ordered he be monitored in the community for three years after his release from prison.
Lord Turnbull told McBride: “You have demonstrated little insight or remorse.”
The judge said McBride had even pretended he was suffering from a psychiatric illness and claimed he couldn’t remember anything about the crimes because of alcohol and drugs he had taken.
These claims were dismissed as “preposterous” by the judge.
Lord Turnbull added: “Many of your victims were deeply upset – some very distressed to the extent they contemplated taking their own lives. Despite knowing this, you continued your behaviour.”
In total, McBride had 42 victims – 15 males and 27 females – and they were aged between 13 and 20.
The judge described him as “an intelligent young man from a stable family background” and said this case highlighted “the risk of sexual exploitation of teenage children”.
Defence advocate Derick Nelson told the court that McBride initially became involved online because he had low self-esteem and found it difficult to form relationships.
Mr Nelson added: “He found himself popular online and began to abuse that. He enjoyed the power and control.”
Advocate depute Douglas Fairley QC, prosecuting, said: “The accused used the aliases David Paterson, Lindsey Smith, Elizabeth McCormick and Jamie Harvey. He induced these teenagers to send him images of themselves in their underwear, naked or engaging in sexual activity.
“In the majority of incidents, the accused then threatened the complainers that he would upload the images to Facebook if they did not send him more photos of a similar nature or perform sex acts on a webcam for him.”
His offences came to light after one of his victims told her mother who contacted police.
Printouts of Facebook conversations and indecent images which had been used by “David Paterson” to threaten her were seized by police.
Further conversations were discovered between the accused and his victims on his laptop. McBride admitted 38 charges of extortion. He also pleaded guilty to charges of fraud and possessing and distributing indecent photographs.
The court heard that, McBride under his alias David Paterson, accepted one 14-year-old girl as a friend on Facebook. To start with, his messages to her were friendly, but the then he threatened her, saying: “If you don’t send me pictures of you naked, I’ll find you and rape you.”
He told her he knew her address and sent a chilling message telling her that her window was open – which it was.
McBride also pestered a 13-year-old girl for a naked photograph. She sent him a picture wearing her bra and another of her in her pants. He put one of the pictures on Facebook and named the girl. He refused to take it offline until she went on a webcam for him.
In January 2013 he told the girl he had booked a room for them at the Fairfield Hotel and said he wanted to meet for sex. He told her that if she did this, he would delete the photographs he had of her.
She told the police that she felt like committing suicide.
McBride was aged between 15 and 20 when he carried out the offences. He has been placed on the sex offenders’ register.