Having someone invade your safe space during a break-in is a horrible feeling.
But having someone hurt your pet during a home intrusion takes it to another level.
16-year-old Javier Mercado was home alone in Des Moines, Washington one afternoon when two people broke into the house. Around noon, Javier heard a noise and saw a car outside he had never seen before. He grabbed his cell phone and hid in a closet.
But his German Shepherd Rex was still in the house and started barking at the intruders.
"I heard the sliding door break, and it is made out of just glass so it shattered really loud," Javier told King5. "My dog ran downstairs, and it just started barking and barking. I heard one guy scream, 'the dog bit me, get the dog.'"
Rex was not letting these bad men get away with anything and was fiercely protecting his young owner. As the men made their way upstairs where Javier was hiding, Rex went into full protection mode and that's when gunshots rang out.
"I could hear my dog, like, really close to me in the bathroom with me, just barking. And the man comes upstairs," said Javier. "I heard one gunshot and several after that, and my dog just cried after every shot that hit him..."
"I thought he was dead for sure. I broke down"
As much as Javier wanted to rush to Rex's side, the first responder he was on the phone with told him to stay where he was. The men trashed all the rooms in the house as Javier stayed hidden in the closet, frozen with fear. Rex had been shot three times and beaten to nearly an inch of his life but he still kept the men from going into the closet.
The men finally left after an hour when they heard sirens.
The police came and Rex was taken to a pet hospital nearby while Javier was rushed to the hospital.
Javier was so happy to get a call telling him that his hero dog had survived. It would take a lot of different surgeries but Rex would be okay. The Mercado family was so grateful to Rex but wondered how they would ever be able to pay for his his medical bills.
"I was worried, my parents were worried. My dad said he was going to start working every Saturday, saving up," said Javier.
Javier's aunt Susy Cadena created a GoFundMe account with Rex's story and the donations came pouring in.
Rex's surgeries were paid for with the help of dog lovers all over the world and Javier's dad wouldn't have to get another job to keep Rex alive. The dog who saved his owner is now slowly on the mend.
Follow his progress on his Facebook page, Rex the Hero Dog.
The family is now looking for a new home after the harrowing break-in as the family is visibly shaken.
As for Javier, he is forever indebted to his loyal canine companion.
"I feel like if it wasn't for him, I wouldn't be here today telling you this story," he said.
Tell us what you think of this story in the comments below.
WATCH NOW: German Shepherd Dog Breed Info