A 33-year-old Lynwood woman was sentenced to five years’ probation but avoided prison time Monday for helping a man, since convicted of sexually assaulting elderly women in Long Beach, carry out a robbery, officials said.

Sophia Yim, who pleaded no contest last month to first-degree residential robbery and first-degree burglary, was also sentenced to 30 days of community service, said Ricardo Santiago, a spokesman for the Los Angeles County District Attorney’s Office.

If Yim violates her probation, she must serve six years in prison, which was her potential maximum sentence, Santiago said. The sentence was handed down in a Long Beach courtroom “all over the people’s objections,” he said.

According to court testimony, Yim admitted to driving Melvin Earl Farmer Jr. in February 2017 to the Bixby Knolls home of a 90-year-old woman, who he then beat and sexually assaulted before making off with three of her rings. It was the final attack in Farmer’s series of robberies and sexual assaults targeting elderly women in Long Beach, most in the span of a week at a senior-housing complex near Atlantic Avenue and Via Carmelitos.

After the robbery, Yim allegedly accompanied Farmer to a Lynwood jewelry store to sell the rings, according to court testimony. The victim relived the ordeal on the witness stand during a five-day trial last month.

A jury convicted Farmer of 13 felonies, but deadlocked on whether he raped a 24-year-old woman two weeks before the crime spree. Farmer will be sentenced Aug. 31 and faces up to life in prison.