The moment a heroic cat jumped in to save a little boy from a dog attack has been captured on camera.

CCTV recorded the moment the fearless feline launched itself at the vicious dog as it bit the four-year-old’s leg in Bakersfield, California, on Tuesday.

On Wednesday, the boy’s dad Roger Triantafilo uploaded the clip to YouTube with the title My Cat Saved My Son, and it had had nearly five million views by Thursday morning.

Warning: The video contains graphic footage of a child being attacked by a dog.

The video above shows the youngster cycling on the pavement before the dog goes for him.

But a horrifying moment turns into a miracle when his loyal cat launches itself at the marauding dog.

His mother Erica is seen running to his aid as soon as the cat has leapt to his defence. She later told local television station KGET-TV that her neighbours voluntarily quarantined their dog after the attack.

"We aren't upset with our neighbours, we're just thankful our son wasn't injured more,” she wrote on Facebook.

"Thank you to everyone, our cat is my hero!"

The boy needed 10 stitches but his parents were just thankful that his injuries weren’t worse. The original video finishes with a graphic image of his bite marks.

Photo credit: YouTube / Roger Triantafilo