A rookie Florida officer on his way home from work  Sunday morning fatally shot a knife-wielding man who had stabbed a woman, a police union official said.

>> Read more trending news

The Miami police officer was driving by Miami Lakes Middle School when he saw a man stabbing a 27-year-old woman, Javier Ortiz, president of Miami Fraternal Order of Police, told the Miami Herald.

The woman was flown by helicopter to a nearby hospital where she is listed in good condition.

"If it wasn't for the swift actions of this officer, there is no doubt in my mind that we would not have had just one homicide here, we would've had a victim that was tragically killed," Ortiz told the Herald.

A neighbor told the newspaper that he saw part of the incident. He said that the two were inside a truck when the police officer arrived.

The shooting happened after the man exited the truck with a raised knife, Walter Villereal told the Herald.

The officer and suspect have not been identified.