A YouTube star who tricked a homeless man into eating biscuits filled with toothpaste and then posted footage of the incident online has been sentenced to 15 months in prison and ordered to pay his victim €20,000 in “moral damages”.

A judge in Barcelona also banned Kanghua Ren, better known as ReSet, from having any social media accounts for five years.

ReSet, who was born in China but grew up in Spain, was among the 200 most popular YouTubers in Spain and Latin America, with 1.1 million followers.

In 2017 he accepted a dare to scrape the cream out of Oreo cookies and replace it with toothpaste.

He found a Romanian man who was living on the streets of Barcelona, handed him the doctored biscuits and a €20 note, and filmed the encounter. The man later vomited.

“Maybe I went a little too far, but look on the bright side: this helped him clean his teeth,” ReSet, 21, said. “I don’t think he’s brushed them since he became poor.”

The video caused an uproar and was taken down after a few days. ReSet then sought out the homeless man and gave his daughter €300 to persuade her not to take legal action.

The judge, Rosa Aragonés, noted it was not an isolated event and the social media star had a propensity for “cruel behaviour” and preying on “easy or vulnerable victims”. She found him guilty of violating the man’s moral integrity.

According to the sentence, seen by the Spanish newspaper El País, Aragonés concluded ReSet had “humiliated and harassed a much older, vulnerable, homeless person … whose life had been blighted by alcoholism and living on the streets”.

The judge said he had done so “to attract the sick attention of his followers” and to boost the advertising revenues generated by the video.

“I do things to put on a show,” ReSet had told the court. “People like sick things.”