A 17-year-old alleged rape victim is being held in juvenile detention to ensure she'll testify at her alleged rapist's trial, which was rescheduled after she previously failed to appear.

The unidentified girl did not show up at a preliminary hearing for Frank William Rackley or at his Feb. 28 trial, causing prosecutors to re-file the case and set an April 23 trial date.

"The last thing we ever want to do is put a victim or a witness in custody, but when you have serious crimes of violence and a multiple offenses, you have to balance the protection of the community here," Sacramento County Assistant District Attorney Albert Locher told ABCNews.com.

A judge signed off on the teen, who is reportedly in the state's foster system and has a history of running away, being held on a material witness warrant on March 14. She appeared before a judge on March 27 and has been in custody ever since, the Sacramento Bee reported.

"I think it's outrageous that the DA's office wants to put a rape victim - a juvenile rape victim - in custody, as if she were the criminal, in a case where she is the victim," the girl's attorney, Lisa M. Franco, told the newspaper.

Rackley's DNA was found on the girl after a rape examination, prosecutors said, according to The Associated Press.

Rackley has a criminal history in the area dating back to 1992. He has a previous arrest for rape. However, those charges were dropped, according to court documents.

Locher said the girl's testimony was imperative and cited the potential public safety issue if Rackley is let go on the charges.

Material witness warrants are subject to judicial review every 10 days.

The girl's next hearing will be Friday, April 6.