In a landmark decision, a Massachusetts judge has convicted Michelle Carter of involuntary manslaughter, saying she is responsible for her high school boyfriend’s suicide.

Juvenile Court Judge Lawrence Moniz said Friday that Carter, now 20, who was accused of encouraging Conrad Roy III to kill himself in 2014, created an environment that would cause harm.

Carter has been on trial for involuntary manslaughter in the death of Roy, 18, who died from carbon monoxide poisoning in July 2014. The case raised new and contentious questions: Can a person be charged and convicted in someone’s death even if she was not with the victim when he died? And can a person be found guilty of killing someone based solely on what she said in text messages?

The judge in the case has ruled yes.

Carter’s sentencing is set for August.

Roy, 18, was found dead from carbon monoxide poisoning July 13, 2014, in a Kmart parking lot several miles outside of Boston. He committed suicide inside his pickup using a gas-powered water pump.

He and Carter, who was 17 at the time, had been texting about death in the days and weeks leading up to Roy’s tragic suicide.

“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 one text.

Carter was later charged with involuntary manslaughter. Her case was tried in juvenile court because she was 17 at the time of the suicide. A juvenile court judge is hearing her case after she decided to waive her right to a jury trial.

In court earlier this month, prosecuting attorney Maryclare Flynn said Carter played a “sick game” with Roy’s life and accused her of seeking sympathy and attention by being the “grieving girlfriend,” according to ABC affiliate WCVB.

Carter’s attorney, Joseph Cataldo, said Roy’s suicidal tendencies predated his relationship with Carter.

“It was Conrad Roy’s idea to take his own life; it was not Michelle’s idea,” Cataldo said, according to the news station. “This was a suicide — a sad and tragic suicide, but not a homicide.”

Roy and Carter met in 2011 and later struck up a romantic relationship – mostly online. Her attorney said they had met only a few times in person over the course of two years before Roy’s death.

Roy had a history of depression and had attempted suicide in the past, but his family was hopeful he would get through it. However, police said text messages they recovered suggest that by 2014, Carter had tired of Roy’s idle talk of suicide and wanted him to go through with it.

Just weeks before Roy committed suicide, he texted Carter, telling her, “we should be like Romeo and Juliet at the end,” according to court documents.

“F—- NO! WE ARE NOT DYING,” she responded.

Days before his death, Carter urged him to get help. “But the mental hospital would help you. I know you don’t think it would but I’m telling you, if you give them a chance, they can save your life,” she wrote. “Part of me wants you to try something and fail just so you can go get help.”

But eventually, Carter’s tone appeared to change.

On July 12, 2014, a day before Roy was found dead, Carter wrote: “So I guess you aren’t gonna do it then, all that for nothing. … I’m just confused like you were so ready and determined.”

“I am gonna eventually,” Roy responded. “I really don’t know what I’m waiting for … but I have everything lined up.”

“No, you’re not, Conrad. Last night was it. You keep pushing it off and you say you’ll do it but u never do. Its always gonna be that way if u don’t take action,” Carter replied. “You’re just making it harder on yourself by pushing it off, you just have to do it.”

“If u don’t do it now you’re never gonna do it,” she added.

Daniel Medwed, a law and criminal justice professor at Northeastern University, told The Washington Post that Carter’s text messages arguably encouraged Roy. What prosecutors had to prove is whether Carter’s encouragement resulted in his death.

Carter was indicted in 2015 and appealed, taking the case to the state’s Supreme Court. Last summer, the court ruled that she could stand trial for her alleged role in Roy’s death. She faces up to 20 years in prison..