TAUNTON, Mass. — Michelle Carter, the Massachusetts woman convicted in June of involuntary manslaughter for encouraging a close friend, through text messages and phone calls, to commit suicide, was sentenced on Thursday to 15 months in county jail.

Carter was 17 in 2014 when the friend, Conrad Roy III, who was 18, poisoned himself with carbon monoxide in his truck. She had faced up to 20 years in prison. Her sentence was stayed pending expected appeals.

“This court must and has considered a balancing between rehabilitation, the promise that that rehabilitation would work and a punishment for the actions that have occurred,” Judge Lawrence Moniz of Bristol County Juvenile Court said, announcing the sentence in a crowded courtroom.

In statements read in court before the sentencing, Roy’s family asked the judge to impose the maximum sentence.

“I cannot begin to describe the despair I feel over the loss of my son,” his father, Conrad Roy Jr., told the court. He said that Carter had “exploited my son’s weaknesses and used him as a pawn in her own well-being.” He said she behaved “viciously,” and he asked the court, “In what kind of world is this behavior OK and acceptable?”

Prosecutors asked for a sentence of from seven to 12 years.

Speaking for Carter, her lawyer, Joseph P. Cataldo, asked the court for leniency and five years of supervised probation. He said Carter regretted what had happened and was in the grip of her own mental illness at the time when these two young, troubled lives came together.

“The goal is not punitive but rehabilitative,” he said.

The sensational case raised thorny questions about whether Carter could be considered responsible for Roy’s suicide — especially when she was far from the scene and had not provided him with a weapon.

But Carter had sent Roy scores of texts encouraging him to kill himself. And on the night in question, after he climbed out of his truck as it filled with fumes, she talked to him by phone and, according to prosecutors and the judge, told him to get back in.

He did, and was found dead the next morning.

Carter’s failure to help him in that crucial moment — either by calling the police or by urging him to stay out of the truck — was what led Moniz to find Carter guilty of involuntary manslaughter during the nonjury trial.