It was just before lunch, and the people in the Massachusetts Eye and Ear Infirmary emergency waiting room were preparing for appointments or biding their time until family or friends were out of surgery. Then the violence broke out.
It all happened very fast. First there was a struggle, and someone yelled to the patients to get down. Then the shots rang out, incongruous sounds in a place where people go to heal.
“I heard them trying to control somebody first, and then I heard shouting, and then I heard the gunshots. It was at least four to six,” said a Winchester woman who asked not to be identified.
When it was over, a Middlesex deputy sheriff had been shot in the leg and the prisoner whom he and another deputy had been escorting had been shot in the chest.
A sense of panic, although momentary, went beyond the emergency room. Hillarie Clarke, 43, one floor above, waiting with family for an appointment, heard gunfire and a woman’s voice on the loudspeaker announce a code blue in the ER.
Before the microphone was turned off, Clarke said, “I heard her say, ‘Don’t go out there, don’t go near him.’ . . . She sounded kind of panicked.”
The fight erupted after the prisoner asked to go to the bathroom in the emergency room area, according to two law enforcement officials who were briefed on the incident. The officials identified him as Raymond Wallace, 36.
As the deputies waited for Wallace, he rushed out of the bathroom and began attacking one of them, trying to wrest the gun from the deputy’s holster, one of the officials said.
“There was a fight. . . . The two individuals fell to the floor and a round was fired,” striking the deputy in the leg, Boston Police Commissioner Edward F. Davis said at the scene.
After the gun went off, Wallace managed to pull the firearm out of the holster, one of the officials said.
That is when the other deputy fired, the official said, striking and seriously wounding Wallace. The deputy who had been shot was being treated at Massachusetts General Hospital and was expected to survive, Davis said.
Wallace was also taken to MGH, where he was under police guard. A spokeswoman for the hospital would not comment on his condition.
It was not immediately clear if Wallace was wearing handcuffs at the time of the incident. He had been brought to the hospital from the Middlesex Jail in Cambridge for “a scheduled medical appointment,” according to a statement from the Middlesex sheriff’s office.
But his stepmother — Larri Richmond, 54, of Ithaca, N.Y. — said Wednesday that he recently told his father that another inmate had attacked him. She said Wallace told his father the inmate assaulted him after Wallace got up to change the channel on a television they were watching.
“He said that he had been kicked about the head, that he had stitches all around his eye, and that he was not able to see out of that eye and that he had stitches all over his head,” said Richmond.
She said Wallace described being threatened at the previous jail he had been held in.
“He’s been threatened in various places,” Richmond said, adding that he has never discussed the reasons for the threats. “He wouldn’t say that sort of thing over the phone.”
Richmond said that Wallace had been selling cars before his last arrest and that the family has not had regular contact with him.
“It’s just that he’s an adult, and he’s in another state, and there’s really not a lot we can do for him,” Richmond said. “There’s not any animosity in the family.”
Wallace had been incarcerated at the Essex County House of Correction in Middleton from June 27, 2011, through Sept. 4, 2012, before being transferred to the Middlesex Jail, according to Essex Deputy Sheriff Maurice Pratt.
“He was transferred because he had enemy issues,” Pratt said. “There was a problem with another inmate.”
Wallace was jailed after being arrested on charges of robbery, armed robbery, masked robbery, and possession of a firearm without a license, Pratt said. Those charges stemmed from an armed robbery of a PetSmart store in Salem in March 2011, a spokeswoman for the Essex district attorney’s office said.
In 2011, the Globe reported that Wallace allegedly robbed the store while masked and armed with a handgun, then drove away in a stolen car. The car was later found in flames.
When police arrested Wallace, they found two handguns and a mask in a car he had rented, officials told the Globe in 2011.
“He was not an extraordinary inmate, good or bad,” Pratt said. “He had one minor disciplinary issue while he was with us.” Pratt did not disclose the nature of Wallace’s discipline. A law enforcement official called Wallace a dangerous individual.
The Suffolk district attorney’s office said it would investigate the use of potentially deadly force by the deputy sheriff in Wednesday’s incident.
Jennifer Street, vice president of communications at Mass Eye and Ear, said investigators had wrapped up their work at the hospital around 5:30 p.m.
“Understandably, we are also caring for staff who were visibly shaken today, but they are doing quite well,” she said. “We are very confident that the Mass. Eye and Ear emergency room is safe tonight.”
Street said the hospital remained open after the shooting, but its emergency department was closed until 6 p.m. No patients or hospital staff were hurt in the shooting.
The Winchester woman, who was at the hospital during the incident, said the shooting happened in the waiting room area, on the other side of a set of doors from where she was.
“I saw them trying to get him down” through glass panes in the doors, she said. “It was like a scuffle.”
The woman said she heard people yelling “get down, get down” and then heard the shots.
After staying in a locked office for about 15 minutes, the woman said, she returned to the lobby and saw a man, presumably Wallace, being taken away on a gurney wrapped in a blanket. “He was in bad shape,” she said.
Travis Andersen of the Globe staff contributed to this report. Colin A. Young can be reached at email@example.com. Follow him on Twitter @ColinAYoung. Javier Panzar can be reached at firstname.lastname@example.org.