The governor of Sao Paulo with Katia Sastre, who shot and killed a gunman trying to rob a group of families. The tweet reads, in part, “I went ... today to pay homage to a very special mother: Corporal Katia Sastre. Her courage and accuracy saved mothers and children yesterday at the door of a school.”

Even watching the scene unfold on video is terrifying.

A gunman rushes up to a group of elementary schoolchildren in Brazil and tries steal a bag. They flee. Mothers grab their children, yanking them to safety.

That's when 42-year-old Katia Sastre decided to act. The off-duty police officer pulled out her own gun and fired at the robber three times, hitting him in the chest and leg.

He fell to the ground but pointed his weapon at Sastre. According to the newspaper Folha de S. Paulo, he fired at least one bullet before his gun jammed. “The first shot ricocheted off something,” Sastre's husband, Andre Alves, told the paper. “On his second attempt to fire, his weapon jammed. Thankfully she was faster than he was, because when a thug discovers he’s being confronted by a police officer, he shoots to kill.”

The man dropped his weapon, at which point Sastre was able to roll him onto his stomach and pin him down until police arrived.

The whole scene was caught on the school's video security system.

Sastre was with her 7-year-old at a school in Suzano, a city near São Paulo. They were waiting for a Mother's Day party to begin, according to Newsweek.

The gunman, 21-year-old Eliventon Neves Moreira, was taken to a hospital, where he died.

Sao Paulo Gov. Márcio França called that outcome “sad and regrettable.” “It is not ideal that the suspect died. We would have preferred this had not happened,” he told reporters. “But it is a warning to those who take up a gun that they could be killed because our security professionals are well trained to protect the public.”

Sao Paulo was once one of the most violent cities in the world. But the area has seen a dramatic drop in crime over the past decade. The homicide rate has declined from a high of 52.5 per 100,000 in 1999 to 6.1 per 100,000 today, about five times lower than the national average, according to the World Economic Forum.

Experts attribute that decline to the drop in unemployment of young men and tight control over who has access to guns and alcohol. Researchers also point to the fact that one gang, known as the PCC, has managed to take over much of the city. “The PCC ... imposed its own brand of criminal order, a kind of Pax Mafiosa,” according to the WEF.

Alves told reporters that his wife has been in the police force for 20 years. She is doing well, he said.

“She is calm, knowing that she acted correctly,” he said. “Everything ended fine. It would have been a greater risk if the suspect had found out she was a cop first.”