A massive fire erupted overnight at an equestrian center in suburban Lake Worth, killing several horses and injuring others.

RELATED: Pictures from the scene

The owner of the South Florida Trotting Center said at an early-morning news conference that 12 horses are dead, while 11 others were taken to a local animal hospital for smoke inhalation and burns. Two of the injured horses are in critical condition.

About 27 horses were inside when the fire started.

Firefighters got the call just before midnight to put out a large barn fire. Officials said flames were shooting 30 feet into the air.

Firefighters said they had two things working against them: a roof collapse and the elements inside that included hay, horse feed and sleeping materials.

Horse trainer Roman Lopez, who says he was inside the barn at time of the fire, heard the horses making a commotion.

When he entered their stables, he said a plume of smoke came out.

Lopez said he tried to save the horses, but for some of them it was too late.

Flames quickly took over much of the barn, and smoke made it difficult to breathe he says.

“A friend of mine came over and tried to open the gates and let them out, but it was just too tough. The roof started to come down, and the horses were just on fire and you just freak out, you don’t know which way to go,” said Lopez.

Investigators later determined the fire was accidental. They said an "unspecified electrical malfunction caused a catastrophic failure at the meter."

That failure caused flames and sparks to ignite nearby hay, feed and other combustible material, investigators said.

Two firefighters were taken to the hospital, but their condition has not been released.

Make donations for the injured horses

Donations can be made for the injured horses at the County Line Feed & Supply store located at 9293 Highway 441 in suburban Boynton Beach. County Line Feed has agreed to accept dropped off supplies, gift cards and checks to help the owners of the damaged center.

MORE PICS: This is another angle of the damage left by from the barn fire. @WPTV @Fox29WFLX pic.twitter.com/FYiJM76tb8 — Andrew Ruiz (@AndrewNRuiz) March 16, 2016