MIAMI GARDENS, Fla. – Jose Sotomayor said he could not believe his eyes when he walked out of his home in Miami Gardens Thursday afternoon to find a man savagely beating a 3-year-old girl. He said she was trapped inside of his 50-gallon recycling bin.

Sotomayor said he was in his bedroom at his home in the 2700 block of Northwest 201st Terrace when he heard noises. He said he walked out to investigate and found 18-year-old Tristin Bernard was hitting his niece with a brick while she was inside the bin.

"I never could have imagined what was happening," Sotomayor said in Spanish.

Sotomayor said he shouted at Bernard and threw him to the ground. He said Bernard took off running, leaving the little girl inside the recycling bin. He said her head was bleeding.

The 3-year-old girl is fighting for her life at a Hollywood hospital after Thursday's attack.

Paramedics rushed the girl to Joe DiMaggio Children's Hospital, where she was listed in critical condition. Police said she suffered severe head trauma.

"She was bleeding, and she is a little girl. Bleeding very hard too so she lost a lot of blood," Dwayne Henry, the victim's cousin, Local 10's Roy Ramos.

A neighbor recognized the girl and said she lived nearby. Police officers later arrested Bernard.

When questioned by police, Bernard confessed to attacking the girl. Bernard told officers that the girl ran out of the house and almost ran into the street. Bernard said he hit her with the brick because she wasn't listening, according to the arrest report said.

Police said officer found Bernard's blood-stained clothes when they searched his home, the report said.

Bernard faces charges of second-degree attempted murder, aggravated battery and child abuse.

On Friday, Bernard appeared in court, where judge set his bond at $160,000.

Bernard was being held at Miami-Dade County's Turner Guilford Knight Correctional Center.

"He will have to be penalized. He will have to be punished," Henry said.