BOSTON — The involuntary manslaughter conviction of a young woman who encouraged her boyfriend through dozens of text messages to kill himself was upheld today by Massachusetts’ highest court.

The Supreme Judicial Court agreed with a lower court judge who found that Michelle Carter caused Conrad Roy III’s death when she told him to “get back in” his truck that was filling with toxic gas after he told her he was scared. The judge said Carter had a duty to call the police or Roy’s family when she knew he was killing himself.

“And then after she convinced him to get back into the carbon monoxide-filled truck, she did absolutely nothing to help him: [S]he did not call for help or tell him to get out of the truck as she listened to him choke and die,” Justice Scott Kafker wrote in the Supreme Judicial Court’s ruling.

Carter’s lawyers noted the only evidence she instructed Roy to get back in the truck was a long, rambling text she sent to a friend two months later in which she called Roy’s death her fault.

Carter was 17 when Roy, 18, was found dead of carbon monoxide poisoning in July 2014. Carter, now 22, was sentenced to 15 months in jail, but has remained free while she pursues her appeals.

Prosecutors had argued Carter could have stopped Roy from killing himself, but instead bullied him into going through with his plan through text messages that became more insistent as he delayed.

“I thought you wanted to do this. The time is right and you’re ready — just do it babe,” she wrote.

“You’re finally going to be happy in heaven. No more pain. It’s okay to be scared and it’s normal. I mean, you’re about to die,” Carter wrote in another.

Carter’s lawyers argued she can’t be convicted because of her words alone, noting she wasn’t with him when he killed himself and didn’t provide him with the means to do it. Her attorney also told the court there was no evidence it would have made a difference if she had called for help, saying she didn’t even know where his truck was parked.

“We can all see from the text messages that Michelle Carter did not force Conrad Roy to kill himself,” Attorney Daniel Marx told the court in October.

Carter and Roy both lived in Massachusetts but met in Florida in 2012 while both were on vacation with their families. Their relationship consisted mainly of texting and other electronic communications.

Both teens struggled with depression. Carter had also been treated for anorexia, and Roy had made earlier suicide attempts.