The object in his hand turned out to be a pellet gun that looked strikingly similar.
Santa Rosa police said 13-year-old Andy Lopez refused to lower the gun and listen to the deputy's orders.
"The deputy's mindset was that he was fearful that he was going to be shot," said Santa Rosa Police Lt. Paul Henry. His agency is leading the investigation into the shooting.
Two deputies spotted the teen in a hooded sweatshirt and shorts around 3:15 p.m. Police said Andy's back was turned toward the deputies, and they did not realize he was a boy.
One of the two deputies noticed what looked like an assault-rifle similar to an AK-47 in his hand. That's when, police say, the deputies pulled over and took cover behind an open passenger door.
One of the deputies ordered Andy to drop the weapon twice, according to a witness, police said.
Andy was about 20 or 30 feet away from the deputies with his back toward them when he began turning around with what one deputy described as the barrel of the assault rifle rising up and turning in his direction.
The 13-year-old was subsequently shot. He was pronounced dead at the scene.
Hundreds marched on Wednesday to remember Andy and protest the shooting, chanting "We need justice," as they questioned how the deputy mistook a pellet gun for an assault rifle.
"If he had been told to freeze, put your weapon down, he would have done that," said Anita Ruiz, Andy's friend. "He was a good kid."
Andy played trumpet in his school band. Staff members and friends described the young boy as a bright and popular student, liked by many in his community, including Lawrence Cook Middle School assistant principal Linsey Gannon.
"Andy was a very loved student, a very popular, very handsome young man, very smart and capable," Gannon said. "Our community has been rocked by his loss."
Santa Rosa is a suburban town of about 170,000 people located about 50 miles northwest of San Francisco in California's wine country.
The Associated Press contributed to this report.