Robert Griffin is accused of shooting 17-year-old William "Nicky" Huertas inside Huertas' home in the 1100 block of Turk Street in San Francisco's Western Addition neighborhood on June 12.
Huertas is believed to have invited Griffin to his home that day, but once inside, Griffin allegedly stole Huertas' .22-caliber rifle and shot him, according to prosecutor Braden Woods.
"The defendant shot the victim to get it," Woods alleged today.
Police found Huertas at about 8:45 p.m. He had been shot once in the head.
Griffin, of Oakland, was arrested Friday. He has since been charged with murder, robbery and burglary.
This morning was Griffin's first appearance in San Francisco Superior Court. Judge Samuel Feng set bail at $2 million. Arraignment, appointment of attorney from the public defender's office, and plea entry was postponed until Thursday.
According to Woods, two witnesses identified Griffin as the suspect.
Woods said there is also video evidence of Griffin and another man "dumping" the stolen rifle three days after the homicide.
Investigators are doing ballistics tests on the rifle in an attempt to confirm it is the murder weapon, he said.