Updated

Two women were killed and a man was wounded on Friday before a suspect covered in blood was arrested at a shopping center in a crowded San Francisco neighborhood that is home to police headquarters and several tech companies, authorities said.

Investigators were trying to determine if the shooting was connected to a botched robbery.

Responding officers encountered the suspect outside the San Francisco Giftcenter & Jewelrymart in the trendy South of Market area.

The man, whose name was not released, opened fire at officers while retreating into a restaurant, police Chief Greg Suhr said. The man kept shooting until he apparently ran out of ammunition and surrendered, Suhr said.

Officers did not return fire because the sidewalks were crowded with shoppers and residents.

After the arrest, officers went inside the shopping center and found the two women dead in the lobby. Their names were not immediately available.

Another man with unknown injuries was taken to a hospital in stable condition.

The shopping center is just blocks from the Hall of Justice, which is the home of San Francisco Superior Court, a jail and police headquarters. Several tech companies, including online game maker Zynga, are also in the neighborhood.

Officers were interviewing witnesses who ducked for cover when the shooting began.

"Somebody was crying or yelling for help. Then I saw the SWAT. There was a dozen of them. They told us to lock ourselves in," Veronica Sirois, who was shopping at the gift center, told the San Francisco Chronicle. "I saw blood on the way out and a pair of bodies."