A puppy in Istanbul escaped death this month thanks to the innovative work of a crew of teen robotics enthusiasts.

The 4-month-old canine, identified by Reuters as a type of livestock guard dog called a Kangal, was stuck down a 230-foot well in a forested area for about 10 days. Local firefighters and miners worked to free the pup, but they couldn’t have pulled off the rescue without the help of the robotics team at Istanbul’s Bahcesehir High School For Science & Technology.

FIRST Robotics Competition Team 3646 INTEGRA Kuyu shortly after his rescue.

When the students learned about the little dog’s plight, they constructed a robotic arm to assist in lifting the puppy out of the well.

“The workers would not have been able to rescue the dog without the help of the robotic arm,” members of the team told HuffPost through a publicist working for the international group FIRST, which promotes science and technology education. “Their efforts were inhibited by the depth of the well. And the fact that they couldn’t dig a new hole because of concern it could cause the well to collapse entirely.”

CONE Communications

The puppy, now named Kuyu, which means “well,” was finally hoisted up to freedom on Feb. 15. After receiving veterinary care, Kuyu was taken to a new home at a local fire station, where he’s being trained as a rescue dog to assist firefighters in saving lives.