A 10-year-old boy was freed Sunday after being held hostage for 30 hours at an Ohio apartment complex.

The standoff in Liberty Township ended around 6:30 a.m. when the man who took the boy hostage surrendered to SWAT negotiators, Fox 19 Cincinnati reported.

Charges were pending against the man, who was not immediately identified. He fired 20 to 30 shots at deputies in the morning and afternoon Saturday. Deputies did not return fire.

The boy’s mother said she was happy her son was safe, WCPO-TV reported.

“He's a brave little boy,” the woman said. “All he wanted to do at the end of the day was protect Mommy. I think he was more concerned about me being safe versus him being stuck with the bad guy."

The standoff began during a dispute at 1 a.m. Saturday between the suspect and the mother, Fox 19 reported.

She and another person in the apartment at the time fled, the Cincinnati Enquirer reported.

The gunman held the boy in the apartment for several hours and then took him to a car parked in a garage attached to the apartment, Fox 19 reported.

The gunman and the boy then spent more than 12 hours in the backseat of the vehicle. The car was running the entire time.