A 31-year-old armed security guard walked in front of a school bus that had scraped his car on a snow-covered Minneapolis freeway Tuesday afternoon and repeatedly shot through the windshield at the driver inside, authorities say.

The gunfire grazed the side of the bus driver’s head and struck his left arm. The injuries were not life-threatening. An 8-year-old student also on the bus was not injured.

On Thursday, the Hennepin County attorney’s office charged Kenneth Walter Lilly, of St. Paul, with one count of attempted second-degree murder and one count of second-degree assault with a dangerous weapon.

UPDATE: St. Paul man charged in school bus shooting concerned for well-being of driver, student, attorney says

Law enforcement authorities responded to a report of a shooting on Interstate 35W at Chicago Avenue at 2:14 p.m. Tuesday. They arrived to find a school bus and black sedan parked in a lane of traffic, according to the criminal complaint.

An investigation revealed that the bus driver was merging onto southbound I-35W near downtown Minneapolis when the bus scraped Lilly’s sedan. The bus driver said he was unaware the vehicles had touched, but there was paint from the bus on the car.

Traffic cameras show Lilly, who was wearing a security guard uniform, pull his car into a lane of traffic before getting out and making his way toward the bus, which was operated by a Minneapolis school district contractor.

The bus driver told authorities that Lilly seemed to be trying to get on the bus, but the driver yelled that he couldn’t let him on because a child was on board, the complaint said.

Lilly is then seen on the video walking toward the bus’s driver side window as the bus appears to try to pull out into traffic, the complaint says. Traffic was moving slowly at the time because of a snowstorm.

Video: Driver shoots at Minneapolis school bus in apparent road rage attack

That’s when Lilly pulled a 9-mm semiautomatic handgun from its holster and started walking toward the front of the bus, according to the complaint. Then he began firing into the windshield.

Afterward, the complaint says, Lilly walked back toward the driver’s side of the bus and called 911. The bus driver was taken by ambulance to Hennepin County Medical Center.

Kenneth Lilly, of St. Paul who is charged with shooting and wounding a school bus driver in Minneapolis, made his first court appearance today. His attorney, Tom Plunkett, addressed the media outside. pic.twitter.com/CVrIIGWM6O — Mara Gottfried (@MaraGottfried) February 8, 2019

Officers recovered five discharged cartridge casings from the scene.

The child, who was seated toward the rear of the small bus, stayed with officers until another bus could bring her home.

Lilly told officers that he shot at the bus driver because he had feared for his safety, but the complaint says video footage shows he had retreated to a safe spot before walking back in front of the bus to start shooting. The complaint does not elaborate as to why Lilly might have feared for his safety.

Lilly has no criminal record in Minnesota. No attorney was listed for him in court records.

He remained in custody Thursday at the Hennepin County jail.

“The actions of Mr. Lilly were outrageous and it was sheer luck that neither the bus driver nor the little girl were killed,” Hennepin County Attorney Mike Freeman said in a statement Thursday. “Minneapolis police are continuing their investigation and if we can add aggravating circumstances for a longer sentence, should we prove him guilty, we will do so.”

Lilly’s family could not be immediately reached for comment.

He is expected to make his first appearance on the charges Friday in Hennepin County District Court.