SAN JOSE — Joseph Vicencio, prosecutors say, entered a parking garage connected to City Hall last week, trained a semi-automatic pistol at the Dr. Martin Luther King Jr. Library and fired off 10 shots.

One nearly hit San Jose State freshman Garrett Bruner as he sat at an eighth-floor desk facing the library’s huge front window, prosecutors say. (The city and the university share the library.) That near-miss fueled the attempted murder charge filed Wednesday against Vicencio, 21, who was also charged with a felony for each bullet he allegedly shot.

Vicencio, a Santa Clara resident, was arraigned in a San Jose courtroom six days after the Sept. 19 shooting, which sent people scrambling to get out of the intersection at Fourth and San Fernando streets where he opened fire, and left several bullet holes lodged in the library and parking garage.

The attempted murder charge includes a gun enhancement, and Vicencio also faces 10 counts of shooting at an inhabited dwelling and two gun-possession charges, all felonies. He is being held without bail at the Santa Clara County Main Jail.

Santa Clara County Deputy District Attorney Marina Mankaryous said Vicencio’s acts could easily have become another mass shooting, adding to what has been widely described as a national crisis.

“Thankfully no one was killed in this case,” Mankaryous said. “But anytime someone shoots at an occupied building, the results can be tragic.”

Mankaryous said it remains unclear whether Vicencio was targeting anyone specifically or what his motive might have been. While San Jose police investigators believe Vicencio used a semi-automatic handgun based on the bullets and shell casings recovered at the shooting site, the actual weapon has not been recovered.

Vicencio appeared alert and attentive at the Wednesday arraignment, seeming jumpy on the one hand and on the other, unperturbed. He answered “Yes ma’am” to a procedural question from Judge Cynthia Sevely. He did not enter a plea, and is scheduled to return to court Oct. 28. If convicted on all charges, he faces a maximum sentence of life in prison.

Vicencio turned himself in to San Jose police Sunday, two days after surveillance images of the shooting suspect were released to the public.

Vicencio’s father, Jimi Vicencio, told this news organization Monday that his son had struggled with mental-health issues, including depression, which he said runs in the family and that Joseph had a “fascination with guns.” Still, the father said he was surprised at the severity of the charges against his son. He added that he was to blame for a dysfunctional home life that led to Vicencio and his brother being taken away from their parents as young children, and living in foster and group homes since.

At the time of his arrest, Vicencio was already being prosecuted for a felony concealed weapon charge stemming from a March incident at a San Jose group home, where an employee searching Vicencio’s room located and eventually wrestled away a 9mm semi-automatic pistol from him, according to a police report.

Vicencio, who allegedly was holding a loaded magazine while hiding the gun in his waistband, later told police officers that his intention was only to hurt himself, not others, according to the same report. He pleaded not guilty to the charges and was scheduled for a preliminary examination next month.

An arrest two years ago at another group home in San Jose resulted in Vicencio pleading no contest to a misdemeanor vandalism charge after a “rage” in which he damaged furniture and property, according to a police report. In both that incident and the one earlier this year, police had him placed on an involuntary mental-health hold for evaluation. Those holds would have barred Vicencio from legally buying or possessing a gun.