A pervert has been charged with “child porn” offenses after he bought a kid-sized sex doll to ‘replace’ his dead son.

Kenneth Harrisson, 54, from Canada, ordered the doll from a Japanese website that advertised childlike and adult sex dolls.

The complicated case has been working its way through court for years, with lawyers arguing over the definition of “child pornography” in instances where a real child isn’t involved.

Instances where real children appear in video or photos, the crime is usually classed as possession, manufacture or distribution of ‘child abuse images’.

But in Harrison’s case the definition has proven more complex, and has resulted in single charges of “child pornography” and mailing obscene matter, and two charges under the federal Customs Act of smuggling and possession of prohibited goods, CTV News reported.

The 54-year-old testified on Monday saying that he didn’t plan on having sex with the doll.

Instead, he claimed to be lonely, adding that he only ordered the doll for companionship to replace his son who died aged just six months old 20-years ago.

During his court appearance, Harrisson fainted and was taken away by an ambulance, according to local media reports.

Defending himself, Harrisson said after Googling “sex doll”, he chose that particular model because it had a “male-like” face that resembled his son.

He said the doll’s face was what appealed to him and the fact it was kneeling in a sexual position did not factor into his decision.

Harrisson went on to say Googling “male sex doll” didn’t come to his mind, which is why he ended up with a child model.

Crown attorney Bill Howse said Harrisson’s explanation that he ordered a female sex doll as a male companion to replace his son “doesn’t make any sense” and asked him to explain further.

“I did not order a sex doll of a childlike nature. The purpose I intended it for was to replace my deceased son, period,” Harrisson said.

Forensic psychologist Peter Collins testified at an earlier trial date that the doll is the size of an infant without sexually mature characteristics.

Collins added that the doll meets the Canadian definition of “child pornography”.

The case will return to court for closing submissions on Tuesday.