But a scan afterwards identified the horse as three-year-old stablemate Millie's Kiss, who had been due to run in a later race at the same course.

"It's an honest error and no-one stood to gain anything by it," said McBride.

Stewards referred the matter to the British Horseracing Authority (BHA).

The result officially stands for betting purposes, but some bookmakers have said they will pay out on the horses finishing first and second.

McBride told the Racing Post he did not notice it was the wrong horse because he was "stressed and rushing" after being delayed collecting the saddle.

"I took a young girl who has been with me for two or three months to the races - she's ridden both fillies and knows them both," he said.

"After we checked them in we got some lunch and I sent her to get the two-year-old ready and I went to the weighing room to get the saddle.

"I like to weigh my horses out early but I had to wait over 20 minutes for the saddle.

"The filly was already out when I got back and as I was stressed and rushing I didn't look that closely - I just assumed it was the right horse."

Mandarin Princess v Millie's Kiss

Mandarin Princess: Born 16 February 2015. No previous races

Millie's Kiss: Born 22 March 2014. Ten previous races, including four at Yarmouth. One win, at Lingfield.

The BHA described the incident as "unprecedented" since a microchipping identification system for horses was introduced in 1999.

It said: "The scan identified the horse to be Millie's Kiss, the trainer's other runner in race four.

"They (the stewards) interviewed the trainer, the stable groom, the veterinary officer and the equine welfare integrity officer responsible for the sampling unit.

"Having heard their evidence they referred the matter to the head office of the British Horseracing Authority and ordered Millie's Kiss to be withdrawn from race four."

Millie's Kiss had been due to run for Newmarket trainer McBride in the 15:15 race.

The responsibility lies with the trainer to present and run the correct horse in the race.

BHA statement

Stipendiary steward Tony McGlone told At The Races all horses are scanned before they are brought into their stables at the course.

"We sent the horse for routine testing as normal and the veterinary officer scanned the horse and found it to be the incorrect horse," he said.

Punter Nicholas Quinn said the controversy had left racegoers bemused.

"This looks very bad for British racing. The one thing you shouldn't have to hope for is that the right horse is in the right race," he said.

'He must be absolutely heartbroken'

John Egan, who rode the 'winner', said he was surprised the horse was not disqualified or the race declared void.

"At the end of the day, we're all human. Mistakes happen. I feel most sorry for Charlie," he said.

John Mear, a member of the Four Winds Racing Partnership that own Millie's Kiss, said they were "shocked and upset" for the trainer.

"It's nothing untoward. He's just made a genuine mistake. He must be absolutely heartbroken," he said.

What the BHA says

"The issue had not been established until after the result had been made official. After the weighed in has been declared on the racecourse, the result cannot be amended by the stewards.

"The responsibility lies with the trainer to present and run the correct horse in the race.

"Having said that, and while we have not seen an incident of this nature in recent times, we will of course determine what steps need to be put in place to prevent it from happening again. We sympathise with the betting operators and betting public who have potentially been affected by this incident."

Analysis

BBC racing correspondent Cornelius Lysaght

Though this may read like something out of a Dick Francis novel, sources at the British Horseracing Authority are indicating this looks more like a cock-up than anything else.

Both horses are bay coloured fillies, and the BHA will seek to find out how they were confused by Charlie McBride and/or his staff; whatever, McBride is looking at a substantial fine.

All horses are microchipped so they can be checked on arrival at the track, but, after this, a second ID check, probably in the paddock before the race, is likely to be brought in.