WELL-dressed in smart suit and straw trilby, the elderly gentleman stands impassively, a slight stoop betraying his age. With three furlongs to go he straightens to his full height, craning his neck to see how his horse is doing. As the field approaches the finishing post his chant begins. "Come on Pat, come on Pat, come on Pat..."

His frail body comes alive. Fists clench, arms pump, torso jerks as the excitement crescendos. As the horses cross the line, the elderly gentleman returns to normal - shoulders slump, age returns with a vengeance - as his horse, and rider Pat Eddery, are pipped at the post... until the next race.

It's the perfect example of the spirit of the races, how emotions can run high in a sport which is both class-ridden and classless, where Arab sheikhs share a passion with the masses - all in York for a day at the races.

Between 17,000 and 20,000 people were at York racecourse yesterday for the start of the biggest event of the season, the three day Ebor Festival.

In days gone by, the Knavesmire was the city's execution ground and even today people still lose their heads as punters try to make a killing.

Glasses chink, the beer and champagne flows and the crowds get into full swing, oblivious to the year-long planning that goes into the event. The less the paying customers notice, the more successful the meeting is deemed to be. The better the planning, the less there is to do on the day.

"It's the biggest event of our season," says Philip Smedley, operations manager for the past six years. "We pride ourselves on attention to detail. We make sure the focus is on the customer so the public has a good day out."

Alcohol and money abound in equal measures. It's the sport of kings followed by the common man and woman. The die-hard racegoers go to gamble, the travelling community goes for the horseflesh, the rich and famous and those just looking for a day out enjoy the occasional flutter.

Prize money for the three days approaches the £2m mark while the bloodstock which races for it is worth tens of millions of pounds.

The day's feature race, the Juddmonte International Stakes, is worth a total of £450,000, the cash raised from sponsors, entry fees and the management of the racecourse. The event is massive in the racing calendar.

To make it run smoothly requires precision planning, executed by a seasoned staff.

In total, 2,000 people stage the event; bookmakers, caterers, 350 racecourse officials, stewards and groundsmen, 17 police officers and 180 security staff. There's even a television engineer, a lift technician, a plumber and an electrician, to ensure whatever the problem, it can be sorted in seconds. There are four doctors, a nurse and three paramedic ambulances for emergencies.

Thousands of bedding plants, which adorn hanging baskets, stands and flower beds, are grown in the racecourse's own nurseries, the best blooms kept back and nurtured for Ebor.

"My job started in October when the last race of the season finished," says Mr Smedley, who is also treasurer of Middleton Hunt. "We start planning then to get everything in place for the season, which starts in May. We are very busy behind the scenes."

Facilities at York are second to none, with most of the year's profits being ploughed into upgrades. This year saw the opening of the refurbished paddock bars at a cost of £900,000. Before that the Knavesmire stand was built at a cost of £10m.

The racecourse also boasts 60 private boxes and suites, 34 pavilions, a 550-seater panoramic restaurant, a 500-seater hospitality marquee, a permanently staffed stable block for 200 horses and a stablelads' hostel. There are also countless bars and food outlets to keep the expected 85,000 punters fed and watered over the three-day festival.

With emotions running high, money at stake and alcohol flowing free and fast, the potential for trouble is huge. A few years back York witnessed drunken travellers racing each other around the city in their Porsches and Ferraris, some of the drivers just 15 years old.

There's also a history of public disorder, particularly after the meeting when those who've won - and lost - spill into the city centre to celebrate or drown their sorrows.

It's something the police are keenly aware of with bars serving copious amounts of booze from 11am to 6.15pm.

Duty Inspector Howard Harding briefs his troops well before the first race at 2.05pm. "Every corner you turn round there is a bar," he tells them. "The objective here is to sell ale and you may well come across people who have had too much. Deal with them firmly, but fairly. If they break the law, we are there to enforce it."

The inspector has two sergeants and 12 officers to police up to 35,000 visitors a day. He also has the support of the small army of security staff employed by the racecourse and closed circuit television inside the course and in the city centre.

Pubwatch and the various door security schemes also pull together to police the city centre after the meeting has finished and revellers hit the streets.

In overall charge of policing inside and outside the course is Superintendent Gary Barnett. He liaises with all manner of organisations from early in the year - racecourse and security staff, licensees and hoteliers, other forces and the national police computer - to get intelligence on offenders.

This ensures troublemakers are quickly spotted, monitored and dealt with before situations have time to get out of hand. At night the city centre has scores of officers on duty to deal with a population already swollen by summertime tourists.

At the racecourse, uniform officers and plain-clothes detectives mingle among the crowds to put off the pickpockets known to target large events.

There are also contingency plans for full-scale emergencies such as bomb scares, fires and terrorist attacks. A police station is set up on site complete with a cell and provision for hasty transfer to the city's police station.

"There is plenty of potential for alcohol-based disorder so we try to keep a lid on it," Supt Barnett says. "It's the all-year round work we do with everyone involved that hopefully pays off on the day."

And keeps everything running smoothly. Horses included.