A 17-year-old National Honor Society member who was to begin his senior year at T.C. Williams High School yesterday instead appeared in an Alexandria courtroom on charges that he stabbed three city police officers during an early morning struggle last week in Old Town.

A prosecutor said in court that the student had told police after he was arrested that he was in Old Town on Friday because he hoped to break into a firearms store and steal a weapon to defend himself -- against whom, it was unclear. The struggle occurred in a brick alley on Duke Street after police said they saw the youth peeping into parked cars with a flashlight and tried to question him.

In a firm voice, and in his only comments during the half-hour hearing, the youth told Judge Nolan Dawkins that he understood the felony charges against him. He offered no explanation for the attack.

Dawkins, the chief juvenile judge, ordered the youth held without bond at a detention home, adding that he "is a danger to the community and likewise to himself" and ending any hope his parents had that their son would be permitted to attend classes while he awaited his next hearing, scheduled for Oct. 7.

The Washington Post generally does not identify suspects charged as juveniles. Prosecutors said they will attempt to have the case moved from juvenile court to Circuit Court, where the youth would be tried as an adult. That move probably would not occur until next month.

Despite the arrest, the youth is an excellent student with a 4.18 grade-point average -- higher than all A's because of Advanced Placement and honors courses -- his mother said in court yesterday. And until Alexandria authorities found him hiding in an alley on South Columbus Street, about two hours after the police officers were stabbed, she said her son had never had any disciplinary or behavioral problems, either at school or at home.

"Did you ever know him to be violent?" the youth's attorney, Jonathan Shapiro, asked her.

"Never," she said in a soft voice. Her husband sat in the front row of the small courtroom, dabbed his eyes and covered his mouth with a red handkerchief.

In fact, the mother said, her son is a promising student with ambitions of attending the Massachusetts Institute of Technology. The family returned two weeks ago from a visit to the Cambridge campus, she said. Her son also is a gifted linguist, a member of a German honor society in which he received a medal last school year.

"He's a scholar. He has plans for the future," Shapiro said at the hearing. "He has plans which may have to be reevaluated and for which he is grieving."

Simply, Shapiro said, the youth most likely "panicked" when he was confronted by police officers about 1:30 a.m. in the 300 block of Duke Street, moments after an undercover female detective saw him peeking into the cars.

"It was not one of those preplanned events," Shapiro said. "It seemed to come out of nowhere."

But Assistant Alexandria Commonwealth's Attorney Shelby Hadfield said in court that regardless of the motivation for the attack, the youth was on a mission last week. Speaking to detectives after his arrest, he told of his plan to steal a gun, she said.

Dressed in a faded and oversized brown sweat shirt and dark green pants, a stubble of a beard on his face, the youth sat quietly beside his attorney. His left hand was bandaged, the result of injuries he suffered during the struggle with police, Hadfield said.

It was a quick fight, authorities and prosecutors said, but ended with three officers badly wounded. One suffered cuts to his abdomen and arm and underwent surgery. The female officer was stabbed in an arm. A third officer was stabbed in the neck, a quarter-inch from his jugular vein, Hadfield said.

Moments earlier, Hadfield said, as officers began to question him, the youth "had a look of panic on his face." And then, "he turned around and struck [one of the officers] with a closed fist," she said, before reaching for a butterfly knife that was clipped to his belt.

Each officer was wearing a protective vest.

The youth was able to break free, even after one officer used pepper spray to end the attack, which occurred near the St. Mary's Catholic Church rectory. He left behind a duffel bag that contained various tools, including a crowbar.

When he was found two hours later, he apologized, Hadfield said.

"He said, 'Please tell the officers I'm sorry,' " she said.

The teenager remains "a danger to himself and to the community," Hadfield said in asking that Dawkins not release him into the custody of his parents.