A teenager who was sent to Maryland's maximum-security juvenile facility for his participation in a gang rape last year was released to live with relatives this week after a judge decided he was not getting the counseling he required.

The youth was released after spending 18 months in juvenile facilities. Prosecutors, who along with several judges and some defense attorneys have called the rape one of the most vicious ever in Montgomery County, criticized the teenager's release, saying that he is still a "danger to the community."

Montgomery prosecutors said that in March 1998, the group of six teenagers lured a 15-year-old girl from a bus stop at the Silver Spring Metro station to a vacant apartment in Wheaton, where they took turns raping, sodomizing and beating her for three hours.

The girl tearfully told Montgomery judges during her other attackers' sentencing hearings that she became a "slave" and "punching bag" to "six brutal and determined boys."

Three teenagers who participated in the rape and were prosecuted as adults have been sentenced to life in prison; another has pleaded guilty and is awaiting sentencing. A fifth teenager is scheduled to stand trial in October.

The youth who was released, who was 15 at the time of the rape, originally was charged as an adult but was later sent back to juvenile court after his attorneys argued that he had a limited IQ and was brain damaged at birth.

District Court Judge Dennis McHugh released the 16-year-old at a hearing in juvenile court in Rockville on Tuesday, saying he was frustrated that state juvenile justice workers did not ensure that the teenager received sexual offender counseling, according to lawyers in the case.

McHugh said the teenager was more likely to be rehabilitated by living at home and going to outpatient therapy than by being held in a facility that was not giving him the necessary counseling, lawyers in the case said.

The 16-year-old, who admitted that he was involved in the rape, will live with an aunt and uncle in Prince George's County and attend High Point High School in Beltsville, lawyers said. McHugh ordered that he receive counseling, that he be with an adult 24 hours a day and that he meet with a probation officer three times a day.

McHugh, citing rules of confidentiality, would not discuss his ruling yesterday, and juvenile case documents are not public.

Maryland juvenile justice officials said yesterday they are investigating how much counseling the 16-year-old received during his 13 months at the Charles H. Hickey Jr. School in Baltimore County, where the state houses its most serious juvenile offenders. The facility is operated under a private contract with the state.

Montgomery prosecutors said the judge also was frustrated that a Department of Juvenile Justice caseworker had not ordered full psychiatric and psychological evaluations on the youth as the judge had ordered in August.

But department spokesman Bob Kannenberg said yesterday that agency officials believe those evaluations were done and that they are limiting their investigation to the amount of counseling that the youth received at Hickey.

"As far as we can tell, the court order was carried out," Kannenberg said. "It's the judge's decision as to whether to release the youth."

Vicky Tyler, the teenager's attorney, said McHugh told the lawyers at the hearing that he was "concerned for the public safety" and believed that the teenager needed counseling and continued restrictions on his freedom "to ensure this didn't happen again."

The judge also noted that he believed he would be criticized for his decision to release the teenager but said the purpose of the juvenile justice system was to rehabilitate, rather than punish, young people, Tyler said.

The judge "didn't feel he could continue to warehouse him" if he didn't get the counseling he needed, Tyler said.

Tyler said that the youth did not qualify for the state's treatment program for juvenile sex offenders because he was not considered a "chronic" offender and that the judge wanted a more "individualized" counseling program than Hickey could provide.

While in Hickey, she said, her client made good grades and seemed to accept responsibility for the crime and to develop genuine remorse about it.

"I think he'll be one of the success stories coming out of the juvenile justice system," Tyler said.

Prosecutors said they're not so sure.

"The crime that he was involved in was so horrific," said Deputy State's Attorney John McCarthy. "It's hard for anyone to reasonably believe that he'd have been able in that relatively short period of time to deal with all his problems."