A young raccoon was crying in pain through the night after it was trapped inside a homemade electrified cage, according to the BC SPCA.

A resident in Vancouver’s Arbutus Ridge neighbourhood heard the whimpers and found the critter in a modified cat trap connected to an extension cord earlier this month.

They unplugged the cord and freed the raccoon before calling the SPCA’s animal helpline.

The SPCA said raccoon trapping is legal with restrictions but it is against the law to use electrocution on them.

It is also using the opportunity to educate the public about the dangers of do-it-yourself pest control.

“The trap was set in the open, where it could have easily captured a cat or other animal, and the homemade electric modifications could easily fail, or harm an unsuspecting child or another person,” it said in a news release.

It encourages people never to feed raccoons and to remove attractants.

If a raccoon approaches, you’re asked to yell, stamp your feet, clap your hands and make noise to scare it away.