NEWARK, N.J. (CBSNewYork/AP) — Police officers say their training kicked in when they resuscitated a 2-year-old girl who was found unresponsive in a swimming pool in Newark.

It happened Sunday afternoon at a home on Third Avenue East, where cops say the little girl was in a small pool wearing two floatation toys and being watched by a family friend. Suddenly, she flipped over and couldn’t lift her head out of the water.

Police body cam video shows Newark officers hitting the child on her back as she struggled to breathe on Sunday afternoon.

“It was terrifying, absolutely terrifying,” Officer Malikul Aziz said.

The dramatic video shows the officers quickly yet calmly getting to work. They were able to clear the girl’s airway before she then threw up food and water, police said.

“As my partner mentioned it could have been death,” Officer Shaquille Johnson said.

Her full-throated cries were a sign that she was breathing again.

“It was a great moment,” Aziz said. “Especially when we knew she was able to breathe comfortably, we knew that we were able to breathe as well too.”

The girl was taken to the hospital, where she was treated and released.

“These Officers displayed the character and dedication that every Newark Police Division member is committed to in providing outstanding community service,” Newark Public Safety Director Anthony Ambrose said in a statement. “I am proud that these Officers stepped in as if this child was a member of their own family. Today, I speak for the entire City of Newark in giving them our most sincere thanks.”

Though they performed like seasoned veterans, Officers Johnson and Aziz are rookies. They both graduated the police academy just seven months ago.

(© Copyright 2018 CBS Broadcasting Inc. All Rights Reserved. The Associated Press contributed to this report.)