A man accused of firing nearly two dozen bullets into a Hillcrest restaurant while customers and employees were inside is not fit to stand trial, a San Diego judge ruled Wednesday.

Judge Jay Bloom ordered Stefano Markell Parker, 29, to spend two years at Patton State Hospital in San Bernardino, California where he will receive psychiatric treatment.

The ruling came after the judge learned of Parker's extensive out-of-state psychiatric history. The District Attorney's office did not elaborate.

Parker is accused of firing 20 rounds into the Golden Dragon Asian Bistro on University Avenue while employees worked and nine customers dined on Feb. 12.

He pleaded not guilty to 13 counts of premeditated attempted murder with a special allegation of discharging a firearm, plus one count of being a felon in possession of a firearm and one count of shooting into an occupied building.

The charges could lead to a 374-year sentence if he is convicted of all counts.

The restaurant is in the heart of a neighborhood known around the nation for its LGBTQ community, and a man whose family owns the restaurant said witnessed an altercation between Parker and a group of Asian Americans outside the bistro the weekend prior.

San Diego police were investigating if the shooting was considered a hate crime but charges of that nature have not been filed by the DA.

Deputy District Attorney Paul Reizen said it was "miraculous that no one was injured" when Parker unleashed a barrage of bullets into the restaurant.

Based off what I've seen, it is clear that this was a premeditated, attempted murder. This was not someone just shooting indiscriminately up in the air. He was aiming at people inside of this restaurant," Reizen said in the days following the shooting.

Witnesses told SDPD Parker wore a trench coat and calmly walked away after the shooting, carrying the rifle with him. Guaderrama said Parker fled down a nearby alley where another witness saw him taking off his clothes.

Officers made contact with Parker and took him into custody without incident.

A trail of evidence, including clothes that matched the witness description and the rifle, were found discarded in the alley where he was found.

SDPD Officer Audra Brown said the evidence initially led them to Parker as a person of interest. He was questioned for hours before being declared a suspect.

"It’s quite a blessing," Brown said. "With that hail of gunfire that went out – that nobody was hit."

According to Guaderrama, Parker's criminal history includes an arrest for homicide in Alabama several years ago.

Investigators are not sure when the crime occurred, but believe it happened between 2000 and 2003. Guaderrama said Parker only served four or five years behind bars for the crime.