ST. CLOUD, Fla. -

The St. Cloud man, who unloaded more than 100 rounds at police with two AK-47s, hurting two police officers, has been sentenced to 20 years in prison on Friday afternoon.

David Penney, 20, was sentenced to 15 years on aggravated battery charges and 5 years on aggravated assault with a weapon, which will be run consecutively. He also received 10 years probation for his one count of shooting at or into a building.

Penny, then 18, was dressed in camouflage when he opened fire on Alabama Avenue in November 2011 and then tried to take his own life, according to authorities.

Dozens of law enforcement officers attended the sentencing, including St. Cloud Police Chief Pete Gauntlett, who testified at the hearing, describing the attack as the worst thing he's ever seen.

St. Cloud Police detective Clinton Wise and Officer Spencer Endsley were injured as they came under fire two years ago, but prosecutors said they believe Penney intended to kill them. Prosecutors said Penney had two AK-47s and had been stockpiling ammunition specifically for the attack.

The Osceola State Attorney's Office negotiated a plea bargain in February that dropped attempted murder and gun-related charges, which could have sentenced him to life in prison.

Prosecutors were apparently concerned Penney was going to claim insanity. A psychiatrist testified that Penney suffers from both Asperger's Syndrome and Autism and would need daily counseling.

The state acknowledged Penney's mental illness in his sentencing but the judge said he felt Penney needed to go to prison.

Penney was given credit for time served-- 493 days-- and two years of community control followed by his probation.

Penney will be  40 years old when he's released.

Watch Local 6 News for more on this story.