A Rush City High School student collapsed outside during gym class and is surviving so far thanks to swift aid from school staff and automatic external defibrillator (AED) shocks applied at the scene from a sheriff’s deputy, authorities said.

Jared Loomis, 14, of Harris, was in critical condition late Wednesday at Children’s Hospital of St. Paul, two days after he went into cardiac arrest, a hospital spokeswoman said.

Loomis was found unresponsive shortly after 1:30 p.m. Tuesday outside the school while in phy ed class, according to the Chisago County Sheriff’s Office.

School staff began cardiopulmonary resuscitation, followed by a deputy stepping in about a minute later with three AED shocks to the teen, the Sheriff’s Office added.

Loomis was taken by helicopter to the hospital in St. Paul.