An Eden Prairie man has pleaded guilty to allegations that he locked his teenage daughter in a bedroom and whipped her roughly 30 times with a tree branch and a belt, leaving bloody and bruised wounds over much of her body.

Craig D. Underwood II, 38, admitted to gross-misdemeanor malicious punishment of a child for his attack on the girl in November after she came home from school on Nov. 15 with someone her family dislikes and having been late for class.

Upon his arrest, Underwood appeared hostile toward police and told them he had “every right to whoop her,” according to the criminal complaint.

The plea in Hennepin County District Court comes with an agreement between the prosecution and defense that he be sentenced to no more than 45 days of incarceration. Underwood remains free on bail ahead of sentencing on June 3.

Underwood made the girl put on shorts, locked her in a bedroom, cut a branch off a tree and “hit her approximately 30 times with both the switch and a belt,” according to county child-protection filings.

The girl also told the investigator that her parents drink alcohol and are joined by her 17-year-old brother to smoke marijuana in front of the other children. She said her father drinks daily and has driven drunk with her in the vehicle. The other children told the investigator they get whipped with a belt or spanked with a hand.

Police were notified and met the girl that day in the driveway of the family’s home, where they saw the teen suffering from swollen hands, fresh lashing injuries, and bleeding and scrapes up and down here legs. She said her father beat her with a tree branch and a belt.

A court-ordered search of the home by a police detective that night turned up a tree branch with black hairs “embedded/attached” that was in a laundry basket and covered by a blanket in the master bedroom, a court filing revealed.

Police also seized two belts and “several pieces of wood” that appeared to come from one or more branches.

Underwood’s criminal history in Minnesota includes convictions for domestic assault and drug possession.