Rialto, CA, police fatally shot a 26-year-old man who stabbed an officer in the stomach in a seemingly random attack at a gas station Friday, authorities said.

David Viveros of San Bernardino approached one of the officers who was seated in a patrol car at a USA Gasoline station, according to the Rialto Police Department. The officers had responded to the station at 6:21 a.m. after a person reported being shot by someone.

The agency released surveillance footage from the station that shows a man walk up to the patrol car before getting into a scuffle with an officer in the driver’s seat. Body camera footage released by police shows the man physically fighting with the officer and then reaching for a knife, KTLA reports.

Viveros allegedly stabbed one of the officers while police used a taser on him twice. After the stabbing, another officer fatally shot Viveros, police said.

The wounded officer was hospitalized.