SAN FRANCISCO — Hours after Uber began offering people in San Francisco rides in self-driving cars Wednesday, California regulators told the ride-hailing company to stop and said it could face legal action if it does not get a state permit.

Uber started a public pilot program in the morning, and by midafternoon, the California Department of Motor Vehicles sent the company a letter saying the service was illegal until it got a permit required for putting autonomous vehicles on public roads.

The cars have an Uber employee behind the wheel to take over should the technology fail.

Uber knew about the requirement but argued that its cars do not meet the state’s definition of an “autonomous vehicle” because it requires a person behind the wheel to monitor and intervene if needed.

Making the distinction on the definition of an autonomous vehicle is in line with Uber’s history of testing legal boundaries. Although the company has been around less than a decade, it has argued with authorities in California and around the world about how much of its drivers’ histories should be covered in background checks and whether those drivers should be treated as contractors ineligible for employee benefits.

“If Uber does not confirm immediately that it will stop its launch and seek a testing permit, DMV will initiate legal action,” DMV Chief Counsel Brian Soublet wrote. He did not specify what that might entail but referenced the possibility of taking Uber to court.

Uber did not immediately respond to a request for comment, so it was unclear if it stopped the service.