A group of schoolchildren were trapped on an out-of-control school bus for nearly 15 horrifying minutes after the driver suffered an apparent medical emergency behind the wheel.

According to the Aitkin, Minnesota, County Sheriff's Office, a deputy noticed the school bus driving erratically on a highway around 4 p.m. on Wednesday afternoon.

When the deputy turned her lights on to stop the bus, it began weaving around the road even more dramatically, nearly crashing in a ditch and hitting speeds of up to 40 miles per hour.

The deputy managed to get around the bus in the opposite lane to alert vehicles coming in the opposite direction that there was a dangerous situation on the roadway.

One driver had to slam the brakes and put their vehicle in reverse to avoid being hit head-on by the runaway bus.

Eventually, a state trooper used stop sticks to get the bus to stop in a ditch.

The bus driver, Scott Gilbertson, 68, was rushed to the hospital.

None of the 11 children, ranging in age from 6 to 14, were hurt in the scary incident.

Watch the harrowing video captured on the deputy's dash camera below.