When a man staying at a motel saw a young child being beaten, he sprang into action.

Don Gilbert heard a commotion outside his room Tuesday night, according to KPTV. Witnesses said Kyle Holder, 32, threw his 2-year-old daughter out the window of a room onto the cement walkway. Holder then repeatedly threw her to the ground and stomped on her head, witnesses said.

Gilbert ended the brutal attack with a few swings of a baseball bat. He said he struck Holder on the back and the head.

Police used a Taser on Holder to subdue him.

Holder appeared to be suffering from delusions. Police said Holder told them, “I did not want to kill her, but I had to. I had to hold my daughter and crush her head so she could go up to the sky.”

The toddler is in critical condition.

Holder is facing a first-degree attempted murder charge.