A heartwarming photo of a Florida police officer holding the hand of a little girl as he walked her back to her family has gone viral.

Clearwater police officer Rich Edmonds was snapped walking hand-in-hand with a six-year-old girl who got separated from her family at Clearwater Beach on Tuesday.

The child had wandered away from her parents while they were on an outing to the west coast Florida beach.

Crying and scared the young girl didn't want to get inside the police car to track down her family, so Edmonds walked with her for half a mile until they found her family.

The officer's police department spread the word about the good deed and called Edmonds a knight in shining armor in a Facebook post.

Clearwater police officer Rich Edmonds was snapped walking hand-in-hand with a six-year-old girl who got separated from her family at Clearwater Beach,Florida, on Tuesday (pictured)

In a Facebook post on Friday morning, the officer's police department spread the word about the good deed and called Edmonds a knight in shining armor (pictured)

Police were alerted to the incident when the child was approaching other beachgoers and that's when Edmonds stepped in.

A passerby saw the sweet moment and took a picture of it and shared it online on Friday morning.

She wrote: 'One lost little girl and one kind and compassionate police officer. There is still good in this world.'

The Clearwater Police Department also shared the touching image on Facebook and said: 'Thank you to Officer Edmonds for taking such good care of the girl!'