Zachary Stein, a 23-year-old New Canaan resident, leaves the Stamford Superior Court after being arraigned in Stamford, Conn. on Tuesday, Sept. 19, 2017. The former Chelsea Piers lifeguard has been charged in the near-drowning of a 5-year-old boy at the Stamford facility. less

Zachary Stein, a 23-year-old New Canaan resident, leaves the Stamford Superior Court after being arraigned in Stamford, Conn. on Tuesday, Sept. 19, 2017. The former Chelsea Piers lifeguard has been charged in ... more

Zachary Stein, a 23-year-old New Canaan resident, leaves the Stamford Superior Court after being arraigned in Stamford, Conn. on Tuesday, Sept. 19, 2017. The former Chelsea Piers lifeguard has been charged in the near-drowning of a 5-year-old boy at the Stamford facility. less

Zachary Stein, a 23-year-old New Canaan resident, leaves the Stamford Superior Court after being arraigned in Stamford, Conn. on Tuesday, Sept. 19, 2017. The former Chelsea Piers lifeguard has been charged in ... more

STAMFORD — It started out as a typical summer afternoon at the Splash Zone: a lifeguard alternated between walking the perimeter of the small Chelsea Piers pool and sitting on his perch overlooking the water as children swam during a break from camp.

But below the water’s surface a 5-year-old boy had been submerged for more than four minutes, apparently out of sight of the lifeguard and other children, court documents say.

Details of the Chelsea Piers security video were released Tuesday as the 23-year-old New Canaan lifeguard pleaded not guilty to risk of injury to a child and first-degree reckless endangerment charges.

Zachary Stein, appearing in court for the first time since his Sept. 6 arrest, was silent during the brief hearing and remained so as he was swarmed by reporters and TV cameras leaving the courthouse. His attorney, Mark Sherman, entered the pleas on Stein’s behalf.

“Despite the arrest, Zach continues to be immensely relieved that this child survived and is recovering,” Sherman said after the court hearing.

The New Canaan boy, Adam Khattak, was released from Yale-New Haven Children’s Hospital four days after the incident.

Stamford police called the boy’s rapid recovery “close to a modern-day miracle.”

According to Stein’s five-page arrest affidavit, the child was underwater for four minutes and nine seconds before he was spotted by the lifeguard.

Video footage showed Stein walking around the 35-foot by 22-foot wide pool as the boy and 10 other children played on Aug. 3. The pool is one of three in Chelsea Piers’ Splash Zone, which consists of slides and other children’s activities.

As Stein walked around the perimeter, video showed the boy slip underwater, according to the affidavit.

The footage then showed Stein sitting on his perch as another boy who had been playing with Adam sat on the edge of the pool with his feet in the water. About 30 seconds later, the boy entered the water, maneuvering around and eventually appeared to be standing near Adam’s body, the affidavit said.

About a minute later, Stein descended from the lifeguard chair and walked around the pool again, the affidavit said. He walked within a few feet of Adam’s body, but did not notice him, the affidavit said.

Stein returned to his chair and appeared to notice something in the pool three minutes and 49 seconds after Adam went under, the affidavit said.

He stood up, walked to the side of the pool and sat on the edge, the affidavit said. Seven seconds later, he jumped into the pool and pulled the boy’s “lifeless” body from the water, the affidavit said.

Stein performed CPR on the boy, who was vomiting and appeared to be somewhat responsive when police arrived, the affidavit said.

B.J. Fisher, director of health and safety for the American Lifeguard Association in Virginia, said earlier this month that the charges against Stein were unprecedented for a lifeguard in this type of incident.

Stein, who had been a full-time lifeguard at the club for five years, resigned following the incident, and Chelsea Piers hired an independent company to review poolside safety procedures.

“It is always challenging when the criminal justice system intersects with first responders who are trying to do their best in difficult situations,” Sherman said Tuesday.

A judge transferred Stein’s case to the Part A docket, where the most serious crimes are heard. Stein is scheduled to be back in court on Sept. 29.