Michael Brandon Hill’s invasion of a DeKalb County school with an assault rifle last year was a bungled attempt at suicide his lawyer told a judge Tuesday, but one that will now cost him 20 years in prison.

Hill was pleading guilty because he wanted to take responsibility for his actions that were driven by his life-long struggle with mental illness and instability in his home life, said his lawyer Annie Deets.

“He knew because there were children the police would come there and they would fire at him and he would die,” Deets told Superior Court Judge Mark Anthony Scott. “He is a 21-year-old man who had the deck stacked against him from birth. He reached out for help but our system, as it exists, is not equipped to give people like Mr. Hill help.”

Deets noted he apologized over the intercom to the children before surrendering, had been in and out of mental hospitals since childhood, was occasionally homeless and often could not get his medications.

Scott acknowledged the significant mental health issues that Hill's lawyer raised in a request for 10 years imprisonment with court-ordered psychiatric assistance after release, but said they were matters best left to the state legislature and Congress.

He followed the prosecution’s recommendation and sentenced the 21-year-old Hill to 40 years, 20 in custody and 20 on probation.

“Good luck to you, Mr. Hill,” Scott said.

Channel 2 Action News obtained raw video footage from a camera positioned outside a door to the school. The two-minute video shows Michael Brandon Hill being let into the school by an adult leaving the building and walking with a child to a parked car. It later shows Hill stepping outside the building several times and pointing a rifle in different directions. The video ends with someone stepping outside the door and speaking into a hand held transmitter, summoning officers into the building.

The incident in August 2013 grabbed national attention after school employee Antoinette Tuff successfully talked Hill into surrendering while he held her prisoner in the school’s office and after he had fired his weapon.

No one was hurt in the tense stand-off. Hill, who was described as quiet and unassuming by his neighbors but as potentially dangerous by family members, had nearly 500 rounds of ammunition for the military-style assault rifle he carried. His brother had accused him in December 2012 of making terrorist threats via Facebook, according to Henry County police.

Hill, along with five other residents, lived in a house a short walk from McNair Discovery Learning Center near Decatur in southwest DeKalb County, proximity appearing to be the reason he targeted the school.

Prosecutor Roderick Wilkerson noted Hill had fired several rounds during the stand-off that lasted less than a half hour. Some of the bullets were fired into the school office floor to scare off staff and some rounds were fired at police, Wilkerson said.

The DeKalb bomb squad ended up blowing up a woman’s car because a dog trained to detect bombs mistakenly alerted on it; police feared Hill had planned an explosive attack, Wilkerson said.

He framed Hill’s actions in the broader context of mass shootings around the country, which had assured the DeKalb case would gain a nationwide profile.

“Fortunately in DeKalb County we did not lose any lives,” Wilkerson told the judge. ““We are not going to tolerate this kind of behavior in this county or in this country.”

Check ajc.com for updates.