At an age when a lot of kids get their first set of braces, the boy standing in court Friday joined a street gang. Two years later, the court heard, he was spending his allowance on marijuana.

None of that mattered much to Cook County Juvenile Court Judge Marianne Jackson, who said of the 12-year-old in front of her Friday: “If I were told he was a choir boy, I would not release him.”

About a month ago, another juvenile court judge ordered the youth locked up, after prosecutors accused him of firing “several” shots at two Chicago police officers in June. Jackson called the allegations “grave and serious” in refusing a defense attorney’s request Friday to release the boy to his home with an ankle bracelet.

With the boy’s parents standing nearby, his attorney reminded the judge of the youth’s age, the fact that he’s only in sixth grade and that he has no criminal convictions.

Prosecutors “strenuously objected” to any pre-trial release.

The boy “is a pledged Four Corner Hustler,” they said. He breaks curfew. He’s been suspended from school on multiple occasions. He smokes pot — paid for with his allowance, they said. And on one occasion, he came home “red-eyed” and “could not recognize his mother because he was so completely under the influence.”

Before the 12-year-old was led away Friday, the judge warned him to watch his behavior while in detention.

“Understood?” she said.

“Yes,” he mumbled.

“What did you say?” she said sharply.

“Yes, ma’am,” he said.

Cook County juvenile court prosecutors have accused the boy and another youth, age 17, of firing “several” shots in the direction of two on-duty Chicago police officers in the 3100 block of West 13th Street on June 5. They say footage from video cameras, gunshot residue and “self-incriminating statements” tie the boys to the crimes. The bullets didn’t hit the police officers. Prosecutors have offered no possible motive.

At a previous court hearing, Juvenile Court Judge George L. Canellis pointed out that the alleged shooters had made an “active step of exiting the car” to shoot at police.

The two youths, whom the Chicago Sun-Times are not naming because they are juveniles, are also charged with multiple counts of aggravated discharge of a weapon, aggravated unlawful use of a weapon and unlawful possession of a firearm. Prosecutors also have charged another 17-year-old, accusing him, among other things, of driving the car away from the scene after the shots were fired.

The two alleged shooters stepped out of a stolen 2007 Nissan Murano and fired shots in the direction of the police officers about 8 p.m. Monday, prosecutors have said. The boys then got back in the SUV, which sped away. Police chased the SUV, which was eventually stopped in the 3700 block of South Pulaski, prosecutors said.

Police recovered two handguns from the SUV, as well as 15 baggies containing suspected drugs from the driver of the vehicle, prosecutors said.

Because all three are charged — for now — as juveniles, all could potentially remain locked up until their 21st birthdays.

All three defendants are due back in court next month.

Contributing: Jordan Owen