A group of youths attacked and robbed a 12-year-old boy of his phone near Union Station on Saturday, with one boy holding what turned out to be a pellet gun to the victim’s head, according to D.C. police.

Bystanders intervened, and police quickly detained two youths, 10 and 13. Police said the 10-year-old had the weapon, which authorities recovered and described as a replica of a semiautomatic handgun. The incident occurred about 4 p.m. in the 200 block of Massachusetts Avenue NE.

A bystander took video of police officers handcuffing the 10-year-old and putting him in the back of a patrol cruiser. The video posted on social media sparked an online discussion over the appropriateness of handcuffing people so young.

One person could be heard on the video telling officers, “That is a child. He is not resisting.” Another person said, “That is not okay. You cannot justify it.”

Police said the officers followed protocol. Everyone taken into custody and transported is handcuffed, to protect the officers and the detainee from injury and prevent flight. Only juvenile truants and curfew violators are not handcuffed unless they become violent, according to police rules.

D.C. Police Chief Peter Newsham said the 10-year-old was driven about a block before he was released to the custody of his mother. The 13-year-old was taken to youth detention. Parents of the youths could not be reached.

“Everyone is feeling sad for the 10-year-old, as am I,” Newsham said. “But I also feel bad for the 12-year-old who had his face bashed in and had his phone stolen.”

Of the handcuffing, the chief said that officers might have tried to be more discreet, but he said regulations were followed. “Having young people in handcuffs is not a look any of us are comfortable with,” Newsham said.

Stephen Bigelow Jr., chairman of the police union, said officers acted professionally but he lamented that such instances put police in an impossible situation.

“It’s the unfortunate reality of what we’re dealing with out here,” Bigelow said. “You’ve got a 10 year-old accused of this kind of heinous crime. There’s nobody that’s going to win in this situation.”

D.C. Council member Charles Allen (D-Ward 6), who chairs the public safety committee, said he might examine other police agencies’ policies regarding handcuffing juveniles.

“I never want to see a 10-year-old in handcuffs, but I also never want to see a gun in a 10-year-old’s hand,” Allen said. “We need to focus on what in the world was going on where a 10-year-old was having a gun, real or fake, and threatening a 12-year-old over a phone.”