When burglars violently broke into a Des Moines, Washington, home mid-afternoon on Wednesday, a teenager hid in a closet and held onto his dog.

>> Read more trending news

But Rex -- a 2-year-old German shepherd -- ran downstairs to protect the 16-year-old.

The dog confronted the burglars, who beat him until he was bloody. The dog ran back upstairs.

With the dog out of sight, the home invasion continued as the two burglars trashed the house room by room. When they came into the bedroom where the teen and the dog were hiding in the closet, and the teen was on the phone with 911, the dog stood up to them with the little strength he had left.

>> Related: Police: Des Moines teen calls 911 from closet during home invasion

He threw himself at the burglars, the teen's family wrote on a GoFundMe page, and was shot at least three times in the neck, leg and knee.

As the sound of sirens became audible, the burglars ran away.

Officers found smashed sliding door glass when they went into the home to get the teen outside safely. They also found Rex, who at first looked dead.

While SWAT teams looked for the suspects, Rex was taken to the animal hospital.

He was eventually taken to BluePearl, where he is in the veterinary intensive care unit, receiving pain medication, antibiotics and wound care, with round-the-clock monitoring of his vital signs.
After making it through the night, the dog is now in stable condition.

As Rex recovers, people on social media have taken to calling him a "hero dog" for intervening between the burglars and the teenager.

"My nephew was protected by his eternal friend until the last bit of strength he had in him to do what his unconditional, loving instinct told him to," family member Susy Cadena said on the GoFundMe page.

The family started crowdfunding after paying large sums of money for X-rays and urgently needed medication for Rex. They hope to raise $10,000 to cover the expenses.

"Our family cannot let Rex the hero dog go without us fighting as hard as he did, to his very last bit of a strength while protecting my nephew," Cadena said.

Meanwhile, officers are still looking for the suspects, and they are trying to figure out why the house was targeted.