With the 138th Preakness Stakes set to run on Saturday, Maryland casino revenue is keeping the state's once-flagging horse racing industry afloat the other 364 days of the year.

Horse racing is a storied tradition in the Free State, dating to the colony's founding in 1633. While the industry faltered thanks to growing purses in neighboring states that legalized slot machines, experts say racing is back on track as Maryland's own casinos provide tracks with millions of dollars.

Gov. Martin O'Malley brokered a short-term deal to keep racing alive in 2010, but the real breakthrough didn't come until the end of last year, when the industry reached a 10-year deal that guarantees a minimum of 100 race days a year at Laurel Park and Baltimore's Pimlico Race Course, home of the Preakness, the second jewel in the Triple Crown.

The mane event
Facts and figures on Maryland's horse industry:
• Maryland is a "horse heritage" state, with roots in equine activities dating back to 1650, when Robert Brooke began importing foxhounds and horses to St. Mary's County.
• George Washington raced horses in Annapolis before the American Revolution.
• Pimlico, home of the Preakness Stakes, hosted the famous 1938 race between War Admiral and Seabiscuit, who won.
• Kentucky Derby winner Orb is co-owned by Marylander Stuart S. Janney III.
• Marylanders spent $48,379,000 feeding their horses in 2009.
• Baltimore County was home to the most horses in 2009, with 8,950. Montgomery was second, with 7,900.
• More than $520 million in bets were placed at Maryland racetracks last year.
Source: Maryland Horse Industry Board

The deal, which maintains 143 race days this year and requires the two tracks to keep a minimum of 1,900 stalls, is built on the piles of casino cash filling state coffers. Racetracks received nearly $35 million in casino revenues in 2012, with $26.4 million going toward race purses and $8.5 million earmarked for structural improvements to the tracks themselves.

"The more casino revenue that comes in, the better the horse racing industry in Maryland will be," said Maryland gambling analyst James Karmel. "It makes a big difference in terms of helping bolster the industry."

The Free State is home to three casinos, with three more on the horizon. The largest is Maryland Live in Anne Arundel County, which contributed more than $13.7 million to racetracks in just the first four months of 2013. Caesar's is planning a casino in Baltimore in 2014, with another set to open in Prince George's County two years later.

While many expect the Prince George's facility will be an $800 million luxury casino built by MGM Resorts at National Harbor, Penn National announced a competing bid to build a $700 million casino at its Rosecroft Raceway harness-racing track and Maryland Casino LLC, a subsidiary of Greenwood Racing, propsosed an $800 million casino in Fort Washington.

The proposals, with thousands of new slot machines, have horse officials champing at the bit.

"Imagine when MGM goes in at National Harbor -- it's going to be huge," said Ross Peddicord, executive director of the Maryland Horse Industry Board. "The appetite for gambling astonishes me."

While the industry originally received 2.5 percent of revenue, that has been reduced to 1.75 percent and will drop to 1 percent when the Baltimore casino opens. Despite the percentage drops, experts say it should be more than enough to bring in better horses and rehab the aging tracks.

"The first thing ought to be renovation," Karmel said. "If you've been to Pimlico or Laurel lately, you can see they need some improvement."

The Maryland Jockey Club outlined preliminary improvement plans for the two tracks, including a major renovation of Laurel Park, in February.

The infusion of cash has stopped a downward spiral that started in Maryland in the 1990s, when neighboring states like Delaware, Pennsylvania and West Virginia began legalizing slot machines at racetracks. The tracks took a cut, allowing them to woo better horses and bigger crowds.

"If you ran a horse in Maryland, you might run for a $10,000 purse -- if you ran that same horse in Pennsylvania or West Virginia, it would be a $50,000 purse," Peddicord said. "Where would you run that horse?"

The downslide hurt the rest of the billion-dollar local horse industry. The most recent Maryland equine census, taken in 2010, showed 29,400 race horses in the state, down from 34,800 in 2002, when the census was last taken. There were 16,040 commercial and private facilities where horses were kept in 2010, down 21 percent from 2002.

Peddicord is hoping more successful races can help rehabilitate the industry. While the 60 percent of the horse industry dedicated to recreation is flourishing, he said, the racetracks' struggles have dominated headlines.

"The racing part of it fell on hard times and had a lot of challenges, but now it's coming back," he said. "Horse racing in Maryland is just the tip of the iceberg," he said. "I think we're headed for another golden age."