iStock/Thinkstock(MASONTOWN, Pa.) — The gunman who opened fire at a Pennsylvania courthouse Wednesday afternoon was scheduled for a hearing on assault charges he received weeks ago, according to authorities.Four people were shot at the municipal building that houses the Fayette County Magistrate Court in Masontown, Pennsylvania, a spokesperson for the Fayette County Emergency Management told ABC News.The gunman entered the lobby shortly after 2 p.m. and began shooting with a handgun, said Lt. Steven Dowlin, station commander of the Pennsylvania Police Department’s Troop B, which handles Fayette County.Police officers from the Masontown Borough Police Department and German Township Police Department then entered the lobby, and Masontown Police Sgt. R. Scott Miller was shot after he engaged the gunman, Dowlin said.After Miller took cover, the gunman continued into the building and shot two males and one female, said Fayette County District Attorney Rich Bower. At the time, several people were in the courtroom, including Fayette County Magisterial District Judge Daniel Shimshock, his staff, an assistant district attorney, several defense attorneys and multiple police officers, Bower said. But, the gunman never made it inside the room.A German township police officer then shot the gunman multiple times, killing him, Dowlin said. He was pronounced dead at the scene but was not identified pending next of kin.The suspect was scheduled for his hearing on charges of strangulation, aggravated assault and simple assault from an incident that occurred a few weeks ago, Bower said. He had an order of protection issued against him as a result of the strangulation charge, the district attorney added.All four of the injured were taken to local hospitals with non-life threatening injuries, Dowlin said. Miller is currently recovering in the hospital in good condition, Bower said.More people would have been lost had it not been for the “rapid” response of the officers, Dowlin said.Although Shimshock’s office is located in the building, neither he or any of his staff were targets of the shooting, Bower said. There were 30 to 40 cases scheduled for hearings that day, Bower said.More than a dozen police officers surrounded the building in the aftermath of the shooting, aerial footage shot by ABC Pittsburgh affiliate WTAE-TV showed. The entrance of the building was cordoned off with yellow police tape, and the glass on the front door appeared to be broken.A medical helicopter could be seen hovering nearby, waiting to airlift possible patients to the hospital.A witness told WTAE-TV that a man opened fire on a woman running across the street.Broadwater said the number of shootings in the areas are “getting out of hand,” referencing a mass shooting that occurred in January in Fayette County and a potential shooting at Uniontown High School that was thwarted.A nearby school was placed on lockdown in the aftermath of the shooting.The investigation is ongoing.Copyright © 2018, ABC Radio. All rights reserved.