LOS ANGELES — Cody Dorman, the teenager who watched his namesake horse Cody’s Wish win at the Breeders’ Cup, has died. He was 17.

Dorman died Sunday after suffering a “medical event” on the family’s way home to Kentucky after attending the world championships at Santa Anita last week, according to a statement from his parents posted Monday on Godolphin Racing’s social media account.

Dorman was born with the rare genetic disorder Wolf-Hirschhorn syndrome, and the effects include delayed growth and development, intellectual disability, low muscle tone and seizures. He used a wheelchair.

“With Cody’s diagnosis at birth, we always knew this day would come, but we were determined to help Cody live his best life for however long we had him,” the boy’s parents, Kelly and Leslie Dorman, wrote.

Dorman first met the horse during a Make-A-Wish visit to Godolphin’s Gainsborough Farm in Lexington, Kentucky, when Cody’s Wish was a 5-month-old weanling in 2018. The animal walked over to Dorman’s wheelchair and put his head in the boy’s lap, creating such a connection that Godolphin decided a year later to name the horse after Dorman.

“I think that horse probably saved Cody’s life in a lot of ways,” Kelly Dorman said Saturday. “I know him and the horse have made a lot of lives better.”

Cody’s Wish won his final race Saturday in the $1 million Dirt Mile, rallying from last and surviving a stewards’ inquiry to defend his title over Preakness winner National Treasure.

Cody Dorman was waiting in the winner’s circle, as if he already knew what the outcome would be.

The victory ensured a storybook ending for Cody’s Wish in his final race before retirement. He won 11 of 16 career starts, including eight in stakes races, and over $3.1 million in earnings for owner Godolphin.

“This heartfelt story has touched the hearts of many in and outside of the Thoroughbred industry,” Dan Pride, chief operating officer of Godolphin, said in a statement. “And while Cody’s passing has saddened us, we find comfort in knowing that Cody found many joyous moments during this journey with his best friend, Cody’s Wish. Our hearts are with the Dorman family.”

Dorman and his family were on hand to receive the Mr. Fitz Award from the National Turf Writers and Broadcasters at the group’s annual dinner last week. The award is for a person who typifies the spirit of racing.

Besides his parents, Dorman is survived by his sister, Kylie.