A horse-drawn wagon packed with people on a holiday outing went out of control for nearly a mile in ­Kandiyohi County in a hair-raising scene after the driver suffered a heart attack, officials said Sunday.

The driver was seriously hurt while several passengers suffered minor injuries.

The wagon ride was connected to the annual “Celebrate the Light of the World” display, a well-known holiday celebration in the Willmar area for nearly a decade.

The horses pulled the wagon over a home’s basketball pole and dragged the pole and hoop for about a quarter-mile before they stopped.

The incident occurred about 7:20 p.m. Saturday near the intersection of County Roads 26 and 9, just east of Eagle Lake and northeast of Willmar, according to the Kandiyohi Sheriff’s Office.

The two horses took off after the driver slumped over, unable to direct them, according to Jeffrey DeMars, a Salvation Army spokesman.

The driver, whose identity hasn’t been released, suffered a back injury in addition to the heart attack.

Of the 15 passengers on the wagon, several were taken to the hospital with noncritical injuries and most were treated and released, the Sheriff’s Office said.

The horses weren’t injured.

The event, held at the Willmar home of Chad Koosman, has raised money for the Salvation Army for several years. The horses belong to another local resident, DeMars said.

The Sheriff’s Office initially said the horses were spooked by “some unknown thing,” but the Koosman family said the driver suffered a heart attack during the ride, DeMars said.

“That kind of explains it a little bit,” he said.

Deputies at the scene arrived to find the driver lacking a pulse and not breathing, the Sheriff’s Office said. He was taken to Rice Memorial Hospital for treatment and remained hospitalized Sunday.

Officials at the hospital later said that he was no longer being treated there Sunday evening.

“Celebrate the Light of the World” is centered around the Koosman home, a few miles west of Eagle Lake, and features more than 400,000 lights.

Guests ride in a wagon to “Santa’s Den” on the display’s grounds and have photos taken with Santa Claus.

After this year’s incident, the Koosmans are calling off the event, DeMars said.

“It’s called ‘Celebrate the Light of the World’ for a reason and when something like this happens, it’s definitely impacting them,” DeMars said. “It’s just heartbreaking.”