A Massachusetts woman convicted of involuntary manslaughter for urging her boyfriend in dozens of texts to go through with his suicide was sentenced to 2 1/2 years in jail Thursday, but was freed on probation pending legal appeals of the case.

Juvenile Court Judge Lawrence Moniz said that Michelle Carter would, in any case, only have to serve 15 months of the full sentence and would then face five years of probation.

Carter, who was found guilty in Taunton, Mass., in June, could have been sentenced to up to 20 years.

During the sentence, Carter, looking tense and red-faced, stared at the floor and then at the judge, turning occasionally to have a brief word with her attorney.

In his decision, Moniz further ruled that Carter was prohibited from gaining any profit from interviews, books, or movies based on the sensational case.

After announcing the sentence, Moniz issued a stay in the case, keeping Carter out of jail temporarily, pending an appeal of the verdict.

The judge called the case, which has garnered international attention, “a tragedy for two families.” Both teens struggled with depression. Carter had been treated for anorexia, and Roy had made earlier suicide attempts.

The trial found that in 2014, Carter, then 17, urged her 18-year-old boyfriend, Conrad Roy III, in a text message to "get back in" a truck filling with carbon monoxide when he got momentarily scared while trying to commit suicide.

The judge said Carter's text constituted “wanton and reckless conduct” under the manslaughter statute. He said Carter had a duty to call for help.

Carter's grim taunt was one of dozens of similar texts she sent Roy urging him not to back down. “The time is right and you are ready ... just do it babe,” Carter wrote in a text the day he killed himself.

“You can’t think about it. You just have to do it. You said you were gonna do it. Like I don’t get why you aren’t,” Carter wrote in another text.

Because Carter was tried as a youthful offender, Moniz has several sentencing options, from committing her to a youth facility, to combining a youth services sentence with an adult sentence, to giving her an adult sentence ranging from probation to a maximum of 20 years in prison.

At the hearing on Thursday, Carter’s lawyers asked for five-year probation, but prosecutor Maryclare Flynn called that “just not reasonable punishment” for her role in the 2014 suicide.

Relatives of Roy addressed the court and said they’re haunted by his death.

Conrad Roy Jr. told a court Thursday that the death of his son, Conrad Roy III, inflicted the “worst emotional pain” he has ever experienced. The father says: “I am heartbroken.”

A 13-year-old sister, Camden Roy, testified that she’s “haunted” by the realization that she’ll never see her brother wed or be an aunt to his children.

Prosecutor Maryclare Flynn argued that Carter showed no remorse and in fact "sought attention and sympathy for herself."

She called probation “just not reasonable punishment” for her role in Roy’s death.

After Roy's death, the prosecution said, she "continued to use and deceive all of them until she was caught by her own words."

Carter’s lawyer, Joseph Cataldo, told the court that both young people at the time were "struggling with mental issues themselves." He asked for a five-year period of probation.

“Miss Carter will have to live with the consequences of this for the rest of her life,” Cataldo told the court. “This was a horrible circumstance that she completely regrets.”

Cataldo earlier argued that Roy was determined to kill himself and nothing Carter did could change that. He said Carter initially tried to talk Roy out of it and urged him to get professional help, but eventually went along with his plan. Cataldo also argued Carter’s words amounted to free speech protected by the First Amendment.

A day after Roy died, Carter posted a lengthy message on his Facebook page in which she mourned his death.

“I’m sorry I couldn’t save you, I’m sorry I let you do this,” she wrote, Boston.com reported.

“I never thought I would have to live a day without him,” Carter said in the post, which was introduced by the prosecution during her trial in Bristol County Superior Court.

Contributing: Associated Press