CNN  — 

A gunman who opened fire Wednesday at a municipal building in a small Pennsylvania town was shot dead by a police officer responding to the incident in which four people were wounded, state police said.

The gunman entered the Masontown Borough Municipal Center around 2 p.m. and began firing, Lt. Steve Dowlin of the Pennsylvania State Police told reporters.

The four victims included a sergeant from the Masontown police department. Their injuries are not life-threatening, Dowlin said.

The suspect had a restraining order against him related to a choking case that was to be heard Wednesday afternoon, Fayette County District Attorney Richard Bower said.

The suspect had been charged with strangulation, aggravated assault, terroristic threats and simple assault as a result of a domestic matter several weeks ago, Bower added.

Bower would not identify the man, saying his next of kin had yet to be notified of his death.

The shooting occurred outside District Magistrate Daniel Shimshock’s office, authorities said.

Shooter looked into courtroom, an attorney says

Eric Randolph, an attorney who was in the courtroom, told CNN affiliate WTAE that he heard one pop and wondered what it was. Then he heard several more pops.

The door flew open and people ran in yelling, “Shooter, shooter.”

Seconds later a man with a gun entered the courtroom and swept his arm around until he pointed a gun at Randolph, the attorney said.

“It was the most intense, frightening sensation I’ve ever had in my life,” he said.

Randolph said he put his head in his hands and when he looked back up the shooter was gone.

Door shot out

Video recorded by a helicopter for WTAE showed that one of the two glass front doors of the Masontown Borough Municipal Center had been shot out.

Amy Johns, a spokeswoman for West Virginia University Ruby Memorial Hospital, said it had three patients from the shooting.

They are a 47-year-old man, a 35-year-old man and a 39-year-old woman. All of them are in fair condition, she said.

A spokesman for Uniontown Hospital said it received one person.

“The patient was treated and stabilized before being transferred to a Pittsburgh hospital,” Josh Krysak said.

Masontown is in southern Pennsylvania, about 55 miles from Pittsburgh and 20 miles north of Morgantown, West Virginia. The town has about 3,300 residents.

CNN’s Kwegyirba Croffie contributed to this report.