AUGUSTA — A China man will spend the next 15 years in prison for a drunken, late night sexual attack on a neighbor whose husband had just left for work.

In court this morning, James A. Bickford, 34, apologized to the victim and to his family, saying he hated himself and was ashamed of what he had done. He vowed never to drink again.

“I am so aware I forever messed up your life and the life of others,” he told the victim, who was in the courtroom in Kennebec County Superior Court, but did not address the judge during the hearing.

Bickford pleaded guilty on Jan. 31 to gross sexual assault and a burglary charge related to the same break-in. He also pleaded guilty to a charge of theft from his former employer.

At today’s hearing, Justice Michaela Murphy imposed the maximum sentence Bickford had agreed to: 25 years in prison, with all but 15 years suspended, and 10 years of supervised released.

His attorney, Walter McKee, argued in vain for a lesser term.

“What occurred was an utterly unprovoked attack on a young woman at night by a stranger,” Murphy said. “It is difficult to contemplate how this event would have ended if she had not been able to get away.”

Acting District Attorney Alan Kelley said Bickford violated the victim’s “sense of home, body and very being.” He said now she has locks on her home, a watch dog, weapons and always has a cell phone nearby.

Kelley said the sexual attack apparently started as a robbery.

The attack occurred on July 29, 2011. The woman escaped naked from her home to seek help after Bickford tried to force her to go with him to a back bedroom.

Bickford was arrested almost immediately by deputies who followed a trail of footprints to his home and heard him snoring loudly. He told them he was asleep and had not heard the woman screaming.

Bickford had formerly lived in the victim’s home and had retained a key to it.