William Pacheco, 18, has been charged in connection with the shooting Tuesday of a 17-year-old in Jefferson Park View Full Caption Courtesy Chicago Police Department

CHICAGO — An 18-year-old man charged in this week's shooting of a teen in Jefferson Park was aiming at another person he thought had robbed him, prosecutors said Thursday.

Around 4:45 p.m. on Tuesday, William Pacheco was in a car with his sister and two children and stopped in the 4900 block of North Milwaukee Avenue to use an ATM when Pacheco saw a group of three people, prosecutors said.

Pacheco thought one of the people in the group had robbed him, prosecutors said. Meanwhile, a person in the group thought that Pacheco was the person who had robbed him.

The two sides yelled at each other and then Pacheco allegedly pulled out a gun and fired into the group, hitting a 17-year-old in the head. The 17-year-old was not the intended target, prosecutors said. Pacheco then drove away.

Members of the group told police that Pacheco was the shooter. When police tried to arrest Pacheco several hours later in the 3100 block of North Springfield Avenue in Avondale, he fled to the basement of an apartment building. There he tried to hide a backpack containing a gun and some marijuana before authorities apprehended him, prosecutors said.

Pacheco was charged with aggravated battery, possessing 100 to 500 grams of marijuana, possession of a gun with a defaced serial number and unlawful gun possession.

Multiple cameras caught the shooting on video, Jefferson Park District Cmdr. Bill Looney said.

The victim was taken to Lutheran General Hospital where he is being treated for "serious facial injuries" including nerve damage, a broken nose and multiple fractures in his face and skull, said assistant Cook County State's Attorney Lorraine Scaduto.

Pacheco, a dishwasher, was held on $400,000 bond.