Sixteen teenage cadets were hospitalized with heat-related illnesses in New York State’s Hudson Valley on Wednesday after the air-conditioning on the bus they were traveling in failed, the authorities said, as the region broiled in a heat wave.

The Orange County Sheriff’s Office said in a statement that the teenagers were cadets in the Junior Reserve Officers’ Training Corps, a national program for high school students that is sponsored by the U.S. military.

Peter Cirigliano, commissioner of Orange County Emergency Services, said the cadets were traveling in two chartered buses from Ring Homestead Camp, an outdoor paintball and ropes-course center in Middletown, N.Y., back to their homes in Burlington County, N.J. About 20 minutes into the ride, around 11:45 a.m., they pulled over after some cadets on one of the buses showed symptoms of heat-related illnesses, including vomiting, lethargy, nausea and slightly altered mental states. The authorities later determined that this bus lacked functioning air-conditioning when it departed the camp.

Temperatures in Orange County reached 96 degrees on Wednesday, according to the National Weather Service, with the heat index hitting 111. An extreme heat warning was in effect across the Northeast and Midwest early Thursday as well.

Emergency workers transported 16 cadets with heat-related illnesses to Garnet Health Medical Center, Montefiore St. Luke’s Cornwall Hospital and St. Anthony Community Hospital for precautionary evaluations. The cadets on the second bus, which had functioning air-conditioning, were also evaluated. All students have since been discharged and reunited with their families.

The buses were operated by D.C. Luxury Coach, and the Orange County Sheriff’s Office and New York State Police have taken the faulty bus out of service.

Ian Ives, a spokesman for the U.S. Army Cadet Command said: “It could have been a scary incident, and we were lucky we had enough personnel who made the right calls.” He said he would provide additional information later today.