A doctor who was grazed by gunfire from a patient in his office at a suburban hospital on Thursday helped stop him by apparently returning fire with his own weapon and severely injuring him, but not before a caseworker was killed, authorities said.

The patient opened fire after entering the office with the caseworker, District Attorney Jack Whelan said. Witnesses reported hearing yelling before the gunshots.

Several hours after the shooting, investigators had only limited information on what happened inside the closed office but believe the doctor, a psychiatrist, "from all accounts, would have acted in self-defense," Whelan said.

The doctor, who suffered a graze wound to his head, "faced a situation where his life was in jeopardy," Whelan said.

Yeadon Police Chief Donald Molineux said that, "without a doubt, I believe the doctor saved lives."

"Without that firearm, this guy (the patient) could have went out in the hallway and just walked down the offices until he ran out of ammunition," Molineux said.

The dead caseworker was identified only as a 53-year-old woman who had entered the doctor's office with the patient before the gunfire erupted. Police said they were trying to find relatives to notify.

Two guns were recovered, Whelan said. Authorities said the motive for the shooting was unknown.

The patient, who was critically injured and was taken into custody, was identified as Richard Plotts, an Upper Darby resident in his mid-30s.

The prosecutor said Plotts had been involved in previous incidents with staff, but he did not know their nature. He also said he did not know if that is why the doctor had a gun or if the doctor would have been required to have a permit.

After the door of the office was closed, staff members heard loud arguing inside, opened the door and noticed the patient had a gun, Whelan said. They then closed the door and dialed 911. Gunshots were heard a short time later, just before 2:30 p.m.

After Plotts emerged from the office, another doctor and a caseworker helped wrestle him to the floor of the hallway and grabbed his weapon, Whelan said. By that point he had already been severely wounded from several shots, he said.

"They acted vigilantly. They acted bravely," Whelan said.

The exchange of gunfire occurred on the third floor of the Wellness Center at Mercy Fitzgerald Hospital, a 204-bed community teaching hospital just southwest of Philadelphia.

Authorities said there are no surveillance cameras in the doctor's office or the waiting area outside. They also said the center had no metal detectors.

"Do you evaluate that now ... in light of this incident to make sure people are safe, especially in what can be a dangerous environment?" Whelan asked.

Patients waiting in the first-floor lobby reported a tense scene when police arrived and ordered everyone out. Most of the patients were elderly.

"I dozed off, and I heard the cop shouting, 'Come on, come on, get out!" said Millicent Russell, 73, of Lansdowne, who was waiting for a 3 p.m. appointment. "There were people with walkers and canes and stuff. All these cops were outside running here and there with these guns."