(CNN) -- Prosecutors building a case against a teenager accused of raping and killing a high school teacher say he apparently planned an attack on a female youth counselor earlier this month, according to court documents.
Philip Chism, 15, took deliberate steps to "elude" staff as he followed a counselor into a locker and bathroom area at a Department of Youth Services facility and, wielding a pencil as a weapon, attacked her, according to an affidavit filed June 10 and released Thursday.
Chism allegedly choked and beat the employee before staff intervened and restrained him.
Chism "took several steps to elude other staff who were believed to be observing him including but not limited to creeping along a common hallway crouched down out of view of observers," Essex Assistant District Attorney Kate B. MacDougall said in the affidavit.
Chism is awaiting trial on charges he raped and murdered his high school algebra teacher, Colleen Ritzer, on October 22, 2013. Police and prosecutors say the teacher was killed with a box cutter in a girls' bathroom at Danvers High School.
He is now being held at Worcester State Hospital, court documents say. Prosecutors have requested that Chism not be allowed in any part of that hospital that is not securely locked; not be allowed to leave without prosecutors' consent; and not be left alone with female staff or patients, according to court documents.
An official at the youth services facility had been warned by MacDougall in November not to allow Chism to be alone with female staff members, court documents say.
A call to one of Chism's attorneys, Susan Oker, was not immediately returned. Denise Regan, another defense attorney, declined to comment Friday.
In January, Chism pleaded not guilty to aggravated rape, robbery and murder charges in the Ritzer case. He is being tried as an adult.
After Chism was reported missing by his mother on the evening of October 22, police had his cell phone company "ping" the location of his phone. It was found near the Hollywood Hits Theater, where investigators learned the teen had bought a movie ticket and then left.
An affidavit said that when Chism was spotted by a police officer the next day, he was carrying a knife. A search of his backpack turned up a bloodstained box cutter. Asked where the blood came from, Chism allegedly responded: "The girl."
He also allegedly carried credit cards and driver's licenses belonging to Ritzer, as well as a pair of women's underwear.
Police discovered Ritzer's body in a wooded area near the school, covered with leaves and debris, court papers said. Her throat was slit.
CNN's Rande Iaboni contributed to this report.