The announcement came moments after the first race at the four-day flagship fixture on Town Moor.
The first meeting in the country to take place in front of paying spectators since mid-March, the decision by Doncaster Council pre-empted further details from Boris Johnson on the re-imposition of lockdown and social distancing rules.
But Doncaster Council had found itself at increasing loggerheads with Arena Racing Company, owners of the racecourse, over the trial which would have culminated with 6,000 people attending St Leger day.
And, in a statement as racing began, Dr Rupert Suckling, Director of Public Health for Doncaster, explained how he had been considering 10 factors each day.
He went on: “The current rate of infection for the borough currently stands at 10.6 infections per 100,000 people which I have been updated on today and this is an increase due to a range of factors including an increase in testing and a lag in the test results coming in.
“Therefore on the grounds of public health and public safety I have instructed the racecourse to hold the St Leger Festival behind closed doors from tomorrow (Thursday).
“The day’s racing will continue today as it is safer to manage racegoers on site and with enhanced test and trace, it will be easier to identify where they are from rather than closing the event today and leaving people to their own devices in Doncaster and the borough generally.
“I appreciate this decision may not be met with universal agreement but it is the safest and most appropriate way to move forward for everyone’s best interests in the borough and beyond.”
Asked about the pilot on BBC Breakfast on Wednesday, Health Secretary Matt Hancock said: “The Prime Minister is going to set out more details of the consequences of the new rule for six people gathering later today. And we’ll set out what that means for some of these events that we were planning to do.”
Doncaster’s elected Labour mayor Ros Jones said in a statement: “My personal opinion remains that the festival is a major risk for the borough that I would rather not see happen but there are no current grounds that can be escalated for it to be held behind closed doors.
“This event, I reiterate, has been imposed upon the borough by government as part of a national pilot for spectators to return to sporting events.”
Ms Jones said: “I fully recognise the need to get back to some sort of normality and appreciate the economic benefits that the St Leger Festival brings to Doncaster but I believe the risk is too great as we are seeing rising infection rates nationally.
“I urge everyone attending the St Leger Festival to follow the guidance, ensure social distancing and to keep themselves and others safe. I would also ask people to behave responsibly in and outside of the racecourse and help the festival pass successfully for the borough.”
Since racing resumed after lockdown at Newcastle on June 1, it has been restricted first to essential staff and from early July onwards owners too.