As plumes of smoke billowed over San Luis Rey Downs and flames barreled toward eight barns at the high-end racehorse training facility in San Diego County, staff struggled to get nearly 500 thoroughbreds out of their stables and away from the flames.

Eventually, they had no choice: the burning barns were deemed too dangerous for vehicles with horse trailers to enter, so workers let the usually-pampered ponies, including some prized prospects for elite races like the Kentucky Derby, run for their lives.

It happened fast. The first flames of the Lilac Fire burst out at 11:15 a.m. on Thursday. Within hours it exploded into a 4,100-acre, out-of-control inferno that had rapidly burned a path to the San Luis Rey Downs facility, more than two miles from fire’s point of origin.

Hundreds of horses made it out safely, but there wasn’t enough time for others. At least 25 burned to death.

Two trainers, Joe Herrick and Martine Bellocq, were severely burned trying to evacuate the horses, said Mike Willman, director of publicity for Santa Anita Park near Los Angeles, which owns San Luis Rey Downs. A third employee at the facility was injured when he was trampled by the horses attempting to herd a group of them out of harm’s way.

“These situations are crazy,” Willman said. “You’re in a stall with a horse and you’re trying to let it loose but it doesn’t want to go, and you could get killed by the horse, and meanwhile the fire’s at the end of the shed. There’s no good way out.”

Trainer Scott Hansen lost 15 horses from his stable of 30 when his barn burned down.

“As soon as the palm trees caught fire it was all over,” he told The Chronicle. “The wind blew the embers and the barns caught fire. It went from a fire a mile away to all of a sudden it was on us. All we could do was turn the horses loose. But we’ll regroup.”

The California Horse Racing Board said it was still unclear Friday how many horses had died.

“We don’t have an exact number because the area is still smoldering and unsafe to enter,” said Mike Marten, a spokesman for the board. Eight barns burned at the state-of-the-art training facility, which is well-known on the horse-racing circuit.

San Luis Rey is normally a peaceful oasis for the highest-end horses. It even has a “regulation-sized equine swimming pool” on its premises. It has housed four horses who went on to win the Kentucky Derby — Fusaichi Pegasus, Sunday Silence, Gato Del Sol and Ferdinand.

These are not the first horse casualties in the fires that have ravaged Southern California for five days: nearly 30 horses burned to death in Sylmar, when the Creek Fire erupted there Tuesday.

Many of the horses that survived the Lilac Fire were evacuated to Del Mar, a racetrack north of San Diego. Mac McBride, a spokesman for Del Mar, said that approximately 800 horses from all over the area had been evacuated to the track.

“We’re dealing with this as best we can,” McBride said. “We’ve had a wonderful outpouring of help from the horse community and the local community. We have more volunteers than we need right now.”

People have dropped off alfalfa, hay, and other feed for the horses, some of whom are being treated for injuries. A GoFundMe page set up online to cover the cost of feed, blankets and medical supplies for the equine evacuees had raised nearly $200,000 by Friday afternoon.

Los Alamitos Race Course in Cypress, Orange County, canceled its Friday races to allow the community to mourn.

“This is a very horse-centered community in northern San Diego,” McBride said, “and horse people tend to look out for each other. That is being manifest here.”

Freelance writer Larry Stumes contributed to this report.

Sophie Haigney is a San Francisco Chronicle staff writer. Email: sophie.haigney@sfchronicle.com Twitter: @SophieHaigney