A security guard trainee at an Amazon warehouse in Ohio was fatally shot by police after he tried to shoot his supervisor at close range and later shot an officer who was saved by his bulletproof vest, authorities said.

The initial shooting occurred around 4:40 p.m. Sunday at the warehouse in West Jefferson and was captured on surveillance footage, police said during a news conference Monday.

Ali Hamsa Yusuf, 22, came up behind the supervisor and pointed a gun at the supervisor’s head, police said, but the weapon apparently malfunctioned and the bullet barely missed the supervisor, who was not injured. There were more than 100 workers inside the building when the shooting occurred, officials said.