But not quickly enough for one British man, who ran afoul of the law when he was caught in the front passenger seat of a Tesla set to Autopilot, cruising at about 40 mph with his hands behind his head.

No one was in the driver’s seat.

Witnesses told police that “traffic was heavy” last May when they saw the nondriver, Bhavesh Patel, 39, of Nottingham, England, in his white Tesla S60 on the M1 motorway near Hemel Hempstead.

Police said in a statement that Patel, who had owned the car for about five months before the stunt, admitted that what he had done was “silly” but said that the car was capable of something “amazing” and that he was just the “unlucky one who got caught.”

On April 20, Patel pleaded guilty to dangerous driving and a court barred him from driving for 18 months.

According to the Bedfordshire, Cambridgeshire and Hertfordshire road policing unit, a passenger in another car used a cellphone to record video of Patel cruising by.

Police said that Patel had switched on the car’s semiautonomous driving function while it was in motion, and then hopped into the passenger seat — “leaving the steering wheel and foot controls completely unmanned.”

It was not clear how far he traveled that way.

The cellphone footage was first posted on social media before it was reported to police, who sent a “Notice of Intended Prosecution” to Patel. He was later interviewed at the Stevenage Police Station.

Authorities consulted a Tesla engineer who said Autopilot features were “intended to provide assistance to a ‘fully attentive driver.'”

The investigating constable, Kirk Caldicutt, said: “What Patel did was grossly irresponsible and could have easily ended in tragedy. He not only endangered his own life but the lives of other innocent people using the motorway on that day.”

Two drivers have died in the United States in Tesla cars with Autopilot engaged: one in a Model S sedan in Florida in 2016, and the other in a Model X SUV in California in March this year.

In its investigation into the death in Florida, the National Highway Traffic Safety Administration concluded that the crash had not resulted from a flaw in Tesla’s systems, but found that Autopilot lacked safeguards to prevent its misuse.

March also saw what was believed to be the first pedestrian death associated with self-driving technology, when a Volvo refitted for autonomous operation by Uber — which had an emergency backup driver behind the wheel — struck and killed a woman on a street in Tempe, Arizona.

As for Patel, who could not be reached for comment Sunday, St. Albans Crown Court ordered him to complete 100 hours of community service and 10 days of rehabilitation, in addition to the driving ban, and to pay 1,800 pounds — about $2,480 — toward the cost of his prosecution.

“This case should serve as an example to all drivers who have access to autopilot controls and have thought about attempting something similar,” Caldicutt added in a statement.

“I hope Patel uses his disqualification period to reflect on why he chose to make such a reckless decision.”