Angelo Fusaro, 65, a resident at the complex, said he had been in his third-floor apartment when he heard a shot and a scream. Rushing to a window in the hallway, which looks down on the lobby, he saw a complex employee lying on the floor. Nearby was another victim, a resident in her 60s, who was bleeding from the neck.

“It was horrible,” Mr. Fusaro said. The police soon arrived, saw him in the window and ordered him to come down the elevator with his hands up.

When Mr. Fusaro stepped into the elevator, he saw shell casings. “I could smell the gunpowder,” he said. The gunman, he later realized, had fled back to his apartment after the shooting.

The employee who was killed had recently started working there, Mr. Fusaro said. He described her as a conscientious worker who took residents’ complaints seriously.

“She was a nice person, great person,” he said. “It’s pretty awful.”

The shooting prompted a two-hour lockdown at schools in Westerly, a waterfront town on the southern shore of Rhode Island, near the Connecticut border. Residents reported a heavy police presence, including armored trucks and helicopters, as the authorities searched for the suspect.