STAMFORD, Conn. — A lifeguard who was on duty at a Connecticut sports complex when a young boy nearly drowned has pleaded not guilty to charges of reckless endangerment and risk of injury to a child.

An attorney for 23-year-old Zachary Stein, of New Canaan, entered the plea Tuesday in a Stamford courtroom.

Investigators say Stein did not appear to be distracted while working at Chelsea Piers Connecticut in Stamford on Aug. 3, but surveillance video shows he didn’t notice the 5-year-old boy underwater for about four minutes.

Stein then pulled the boy from the water and gave him CPR.

His lawyer says he is “immensely relieved” that the child survived and said a mistake does not constitute a crime.