police car
A representational image of police cars at a music bar where a gunman opened fire in Los Angeles, Nov. 7, 2018. JAVIER TOVAR/AFP/Getty Images

A 48-year-old man fatally shot himself in his car Wednesday night near Orlando after being police pulled him over as a suspect in a child pornography case and while his two children were in the car.

Kissimmee police pulled over Luis Valentin during a traffic stop with two detectives approaching the vehicle on both sides. The officers initially did not realize there were two children, a 7-year-old and an 11-year-old, also in the vehicle but quickly and safely removed them from the car.

When police returned to Valentin, he took out a gun and shot himself. He died at the scene.

"Due to the brave actions of that one detective, he actually opened the door, grabbed the children and brought them immediately to safely," Deputy Chief Daniel Schad said, according to WKMG, a CBS affiliate in Orlando.

Valentin's ex-wife, Ana was at the scene as well, and told ABC-affiliate WFTV that he "always said that before he would be in jail he would kill himself."

The two children were later reunited with their mother.