The wife of Mayor Rahm Emanuel stood in a juvenile courtroom Monday and listened to an 18-year-old man apologize for punching her teenage son in the face and stealing his iPhone in a brazen mugging across the street from the Emanuel family’s home on Chicago’s North Side.

Phillip Payne, who was 17 at the time of the Dec. 19 attack, pleaded guilty to theft and the aggravated battery of Zach Emanuel during a hearing attended by Amy Rule, the mayor’s wife. But Zach Emanuel has said he was jumped from behind by two people — and Chicago Police say an investigation into the second suspect is ongoing.

Cook County Judge Lori Wolfson sentenced Payne to three years of probation and ordered him to perform 50 hours of community service. He was told to stay away from Zach Emanuel, was given a 6 p.m. curfew on school nights and could be held in custody up to 30 days if he violates his probation. He is supposed to stay away from drugs, gangs and guns, and he must work or pursue an education.

While police normally don’t identify a juvenile charged with a crime, records show Payne also faces charges as an adult for lying to the cops Feb. 6 about his identity a week after he turned 18. It was after his arrest in that case that he admitted to mugging Zach Emanuel.

“Payne gave a full confession as to his role in the robbery,” Chicago Police spokesman Martin Maloney has said.

Wolfson ordered Payne held in custody last month, and he appeared Monday in handcuffs and a blue sweat suit. His stepfather stood nearby.

Rule had nothing to say during Monday’s hearing at the Cook County Juvenile Center. She nodded after Payne told her, “I apologize,” for the attack on her son. She shook prosecutors’ hands and thanked them as she left the courthouse but ignored reporters.

Wolfson said she thinks Payne understands “this is the last opportunity he’s going to have as a juvenile.” During the hearing, the judge expressed frustration when Payne’s public defender told her that Payne gets good grades in school.

“You are capable of doing well in your life,” Wolfson told Payne.

The judge later added, “Phillip is not a violent person.”

Chicago Police have said a trail of online sales of Zach Emanuel’s stolen iPhone led them to Payne.

Eight hours after the robbery, the deactivated iPhone was put up for sale, and the man who bought it from Payne then resold it to a woman on Facebook, police said.

“When the woman who bought the phone tried to activate it with her mobile provider, it didn’t work,” Maloney said. “She took it to a small retailer, who ran it through a database. The retailer saw it had been reported stolen, and they gave her the phone number it had been associated with.”

The woman contacted Zach Emanuel, and “he connected her with police,” Maloney said.

The woman cooperated with detectives, leading them to the man who sold it to her, and he identified Payne.

“Cases with these facts are solved almost every time, if not every time,” Maloney said. “When detectives have information — like a serial number — to work with, it makes catching the offender a much more manageable task.”

Though police have charged only one person, “there is an ongoing investigation into a second offender,” who Zach Emanuel told the police held him in a chokehold and ran off with Payne, Maloney said. He declined to elaborate, citing the pending investigation.

According to police and court records, Payne is an admitted member of the Black P Stones street gang’s Wicked City faction. Its members hang out around Sunnyside and Magnolia, records show, roughly 1 mile from Emanuel’s home.

Payne was already serving a year of juvenile court probation for possessing a stolen vehicle — a crime he was charged with last September, records show.

The robbery of Zach Emanuel happened about 10 p.m. on Friday, Dec. 19.  The mayor’s son told police he had been walking north in the 4200 block of North Hermitage, across from his family’s home, and talking on his cellphone. Zach Emanuel said the two men jumped him from behind.

Security cameras near the mayor’s house didn’t capture the robbery.

By the time of Payne’s arrest on Feb. 6, he already had been identified as a suspect in the mugging. The trail that led to him started with the Emanuels, who, according to Maloney, “had kept a record of the phone’s serial number” that was added “to a database carriers and retailers use to determine if a phone has been stolen.”

Contributing: Chris Fusco