MDEA had been investigating Berkwitz-Gutierrez and her boyfriend, John Paul Haddad, 26, of Hollywood, Fla., since autumn 2012. Agents suspected the pair were orchestrating a drug trafficking run from Florida to Maine, and used confidential informants to set up a buy.

After the agent made the purchase, police went to the room at Colonial Inn where the duo was staying, where they found another 248 oxycodone pills and $1,776 cash.

Berkwitz-Gutierrez, who has no previous criminal background, said she did not dispute the evidence against her, and admitted she had tried to sell the drugs, which were prescribed to her.

“I’m not a person who normally does things wrong,” she told Justice Ann Murray. “I did this, and it was wrong, because I needed the money.”

Haddad also was charged with felony trafficking and is free on bail. He is scheduled to appear in court on May 23.

Berkwitz-Gutierrez had been freed from jail on bail a few days after her arrest, but turned herself in again on April 18 because she has no family or friends in Maine. She lives in South Carolina, she told Murray, though her license lists her as a Florida resident.

She accepted a plea agreement that would suspend all but nine months and one day of a three-year prison sentence, after which she’d be on probation for two years. She also will pay a $400 fine.

Berkwitz-Gutierrez was told she could apply to transfer her probation to South Carolina, where she can serve out her sentence near friends and family.

Murray was hesitant at first to accept the guilty plea, because the transfer of probation, which Berkwitz-Gutierrez was counting on in the plea agreement, was not a guarantee. The justice asked Berkwitz-Gutierrez what she would do if the transfer was not granted, and the plaintiff said she’d seek to serve her full three-year sentence in Maine if she couldn’t be released to South Carolina.

“I don’t know anybody here,” she said. “If for some reason I can’t go home to South Carolina, I’d rather do my time here until I can.”

Ultimately, Murray accepted the plea and the plea agreement. Had the case gone to trial, Berkwitz-Gutierrez faced up to 10 years in prison and up to $20,000 in fines.

A previous version of this story incorrectly stated that Kelly Berkwitz-Gutierrez was sentenced to three years in prison with all but 91 days suspended. The sentence was all but nine months and one day suspended.