Updated

A man accused of kidnapping a 14-year-old girl and raping her in an underground bunker pleaded guilty Tuesday, moments before his trial was to begin.

Vinson Filyaw stood with his arms clasped behind him as he quietly answered, "Yes sir" when the judge asked him if he was freely pleading to the charges. The victim sat with family members, her mother's arm around her.

Filyaw, 37, could spend the rest of his life in prison. He pleaded guilty to kidnapping and all 10 counts of criminal sexual conduct, one for each day prosecutors said he held the girl captive a year ago in Kershaw County. Each criminal sexual conduct charge carries a sentence of up to 30 years in prison.

He also pleaded guilty to impersonating an officer and possession of an incendiary device.

Prosecutors said Filyaw wore a homemade uniform when he led the girl away from a school bus stop.

The teen was rescued last year after she sent a cell phone text message more than a week after her abduction.

Opening arguments had been scheduled for Tuesday morning in the trial. The case was moved nearly 200 miles to Beaufort County, in the state's southern tip, for fear publicity would interfere with Filyaw getting a fair trial.

TV station WLTX reported Monday evening that Filyaw had sent a manuscript that said Filyaw stalked the girl and admired her ingenuity in gaining his trust to get his cell phone.

In the writings, Filyaw allegedly said he watched the girl walk from her bus stop to her Kershaw County home before deciding to kidnap her. "I actually felt guilty for what I knew she was about to endure," he wrote, according to WLTX.

Prosecutors said Filyaw kept the girl in a hidden bunker built into the side of a hill for 10 days. According to the manuscript, he wrote that he felt a bond growing between them and started to trust her enough to let her out of the bunker to help him wash clothes and dishes.

The girl asked Filyaw if she could play games on his cell phone, and he let her, according to the manuscript. The girl sent a text message to her mother which rescuers were able to use to find the bunker, authorities said.

"After a year of careful, meticulous planning I had let her win. I literally gave her the phone to call the police. It was as simple as that," Filyaw allegedly wrote. "I couldn't be mad at her. She had done what any person in her situation would have done and probably better! She had won my trust and defeated me."

Filyaw had left the bunker before police arrived. He made it several miles away before deciding to surrender. "If I gave up, I would have full medical coverage, three meals a day and never have to work again," the manuscript said.