This story has a happy ending but serves as a warning to dog owners: keep your dog on a leash and always keep him in your eye line, especially around elevators and other moving machines.

A video posted to Facebook by Brian Ussery, a maintenance supervisor at a Springfield, Mo. apartment building, shows a scary incident where a dog got separated from his owner by closing elevator doors. The owner walked into the elevator and the doors shut before his dog made it in; as the elevator moved up, the dog's leash tightened and flung him up to the top of the elevator, reported KTLA. Luckily, Ussery saw what happened and quickly ran to the dog's aid, breaking his leash before the elevator got moving again. Amazingly enough, the dog wasn't even injured.

Thanks to Ussery's quick thinking and action, the dog is completely fine. "I would hate to know what would have happened if I wasn't able to break that leash before she got to the top again," said Ussery, according to The Daily Mail.

The dog's owner had gone up to the fifth floor and was panicking by the time he got back down to the first floor lobby. "The guy was freaking out. He didn't know what he was going to come back to," said Ussery in a comment on his video, according to The Daily Mail. "He was very thankful," Ussery added.

Ussery took home a recording of the security footage that captured him saving the dog. "When I first took the video it was just to show my fiancée. We are both huge dog lovers. Never in a million years did I expect it to be shared and viewed so many times. I posted it as a warning about leashes and elevators," said Ussery in the description of the video, according to KTLA.