A shooting inside a California Costco unfolded after a man without apparent provocation attacked an off-duty police officer, authorities said Saturday.

The Los Angeles Police Department officer, holding a young child and shopping with his family, opened fire and fatally shot the man Friday night, said Officer Tobias Kouroubacalis with the police department in Corona, California.

"The officer's gun was the only weapon involved in the incident," Kouroubacalis said in a statement. The child wasn't injured, he said.

The alleged attacker, identified as Kenneth French, 32, of nearby Riverside, was declared dead at the scene, police said. Two of his family members were injured and were in critical condition, Kouroubacalis said.

The Los Angeles Police Department officer, whose name was not released, was treated at a hospital for unknown injuries, officials said.

Authorities were called to the store in Corona, about 47 miles from Los Angeles, Friday night after reports of several people injured. Police initially said the suspect had been taken into custody.

Nikki Tate, who was shopping for food for Father's Day, told NBC Los Angeles that she and her daughter hid as gunfire erupted.

"I crawled around to where she was and it was hysteria," she said. "I didn't know if this was another mass shooting."

Costco did not immediately respond to a request for comment.