A Texas father may have been within his rights when he beat a man to death after allegedly catching him in the act of molesting his four-year-old daughter.

According to reports, the incident took place Saturday while the little girl's family was hosting a get-together at their home in rural Shiner, Tx.

While many of the guests left the house to attend to the family's horses, the four-year-old remained in the house, according to Lavaca County Sheriff Micah Harmon.

When the father returned and discovered the alleged attack taking place, he reportedly struck the man in the head several times, killing him. According to preliminary autopsy reports the man died due to blunt force head and neck injuries.

The alleged attacker was pronounced dead at the scene, and the daughter was taken to a hospital in Victoria, Tx. for examination.

The sheriff said she was "OK, besides the obvious mental trauma."

The name of the man who was killed is being withheld, along with the identities of the father and daughter.

Harmon said the father didn't intend to kill the man, whom he considered an acquaintance, but may not have broken any laws by doing so.

"You have a right to defend your daughter," Harmon told media. "He acted in defence of his third person. Once the investigation is completed we will submit it to the district attorney who then submits it to the grand jury, who will decide if they will indict him."

The killing may be justified under Texas' Defense of Third Person law. The law allows citizens to use deadly force against anyone committing or attempting to commit sexual assault and other crimes.

"The actor would be justified under Section 9.31 or 9.32 in using force or deadly force to protect himself against the unlawful force or unlawful deadly force he reasonably believes to be threatening the third person he seeks to protect," said a description of the law on the Texas penal code website.

A story on CNN's website had received more than 8,000 comments as of Wednesday morning, many of them supportive of the father's actions.

Someone posting under the name Sozojeff summed up the tone of many of the commenters: "I can't help but think of the suffering of countless other little girls and/or boys this father has probably stopped or prevented from happening. Hats off to you dad," he wrote.

On Twitter, many expressed similar sentiments.

"To the Texas Dad that beat the creep to death for molesting his 4yo daughter, where would you like the Father of the Year trophy sent to?" asked @TheMichaelRock.