CHICAGO (CBS) — A 16-year-old boy has been charged in a pair of carjackings in Albany Park and an attempted carjacking of two off-duty Chicago police officers in Uptown, and was ordered held in juvenile detention as he awaits trial.

Cook County prosecutors said the boy was arrested at his home on Thursday, after the victim of one of the carjackings identified him as the assailant, and he later confessed to two other incidents.

READ MORE: 8-Year-Old Boy Shot, Killed While Playing On Front Porch In Markham

He is charged as a juvenile with four counts of aggravated vehicular hijacking, two counts of vehicular hijacking, one count of attempted aggravated vehicular hijacking, one count of attempted vehicular hijacking, two counts of aggravated assault, one count of armed robbery, one count of aggravated robbery, and one count of robbery.

Prosecutors said the first incident happened on June 10, when two brothers were parking their cars on the 3100 block of West Ainslie Street. Two gunmen wearing masks, including the 16-year-old, got out of a white SUV and tried to steal one brother’s car, but couldn’t drive it because it had a manual transmission, so they walked up to the other brother, asked if he had any money, stole his cell phone, and then drove off in his 2003 Kia Rio, according to prosecutors.

On July 4, the same 16-year-old approached a man who was parking his 2016 Ford Explorer on the 3000 block of West Ainslie Street, and pointed a silver handgun at him. The teen threatened the victim and demanded his vehicle, then drove off in the Explorer, prosecutors said.

Three weeks later, the boy approached walked up to two men who were parked in a 2021 Audi Q5 on the 1200 block of West Ainslie Street, and knocked on the front passenger side window. The men, both off-duty police officers, rolled down the window to ask the teen what he wanted, when the boy pointed a gun at the passenger, according to prosecutors.

READ MORE: Vandal Caught On Camera Trashing Trader Todd's Bar In Lakeview, Leaving Racist And Threatening Graffiti

The off-duty officer in the passenger seat grabbed the barrel of the gun, but the boy was able to pull it away. The officer who was driving rolled up the window and the officer in the passenger seat pulled out his own gun and fired three shots at the boy, who ran off and got away unhurt. Prosecutors said it turned out the weapon the boy had pointed at the officers was a BB gun that looked like a real gun.

The victim from the July 4 carjacking was able to identify the 16-year-old from a photo array, and police arrested him at his home on Tuesday. While he was in custody in that case, detectives questioned him about the two other incidents, and he admitted to trying to carjack the two off-duty officers, and to taking part in the June 10 carjacking, prosecutors said.

A judge ordered the boy to remain in custody at the Cook County Juvenile Temporary Detention Center as he awaits trial.

Defense attorneys had asked the judge to allow the boy to go home on electronic monitoring, since this is the first time he’s been charged with a crime, but the judge agreed with prosecutors that the violent nature of the crimes he is accused of make the boy a danger to the public and himself, noting he could have been killed when he tried to carjack two off-duty officers and they defended themselves.

MORE NEWS: Chicago Weather: Beach Hazards

The boy is due back in Juvenile Court on Thursday.

CBS 2 Chicago Staff