TAUNTON, Mass. — The Massachusetts teenager prosecutors say was coaxed by text messages from his girlfriend into killing himself had researched suicide online, a defense witness testified Friday.

Steven Verronneau, a forensic investigator with MWV Multi-Media Forensics, said he had analyzed the computers and phones owned by Conrad Roy III as well as Michelle Carter, who’s charged in Roy’s July 2014 death.

Carter, now 20, was 17 when the 18-year-old Roy died of carbon monoxide poisoning in his pickup truck in a store parking lot in Fairhaven. She is charged with involuntary manslaughter.

Roy googled “suicide by cop,” visited a website that explained “Easy, quick and painless ways to commit suicide,” and researched which medications would kill him in his sleep, Verronneau said in Taunton juvenile court.

On cross-examination by prosecutor Katie Rayburn, Verronneau acknowledged that he also found family photos on Roy’s devices in which he could be perceived as happy. He also said Carter had likely deleted some messages from her phone she had sent to Roy.

The defense also called a police officer from Roy’s hometown to the stand.

Mattapoisett Patrolman Justin King said he found Roy with a swollen and cut face once while responding to an assault report.

Both witnesses appeared to back assertions by Carter’s attorney, Joseph Cataldo, that Roy had long contemplated suicide and was depressed partly because of physical and verbal abuse from family members.

The defense started calling witnesses after Judge Lawrence Moniz denied Cataldo’s motion for a directed verdict of not guilty, a standard legal procedure. The prosecution has rested.

The case is being heard without a jury in juvenile court because of Carter’s age at the time of Roy’s death. She was charged as a juvenile offender, which could subject her to adult punishment if convicted.

In an unrelated Utah case, an 18-year-old man faces a murder charge for allegedly using cellphone video to record the death of a 16-year-old girl found hanged from a tree. Police say Tyerell Joe Przybycien bought the rope his friend used last weekend, made no attempt to help her, and recorded her death. Assisted suicide is illegal in Utah. He has been charged with first-degree murder.

The Carter trial is scheduled to resume Monday.