SAN FRANCISCO — In a surprising about-face, Uber said Thursday it will apply for the state permit needed to legally test its self-driving cars here — a step the company previously had refused to take.

Uber’s move to work with state regulators comes nearly two months after the California Department of Motor Vehicles forced the company’s autonomous Volvos off San Francisco streets. It also comes two days after CEO Travis Kalanick, reeling from a series of embarrassing scandals within the company, said he “must fundamentally change as a leader and grow up.”

Uber, the world’s most valuable startup, wouldn’t say when its autonomous cars might return to San Francisco streets.

“We are taking steps to complete our application to apply for a DMV testing permit,” an Uber spokeswoman wrote in an emailed statement Thursday. “As we said in December, Uber remains 100 percent committed to California.”

DMV spokeswoman Jessica Gonzalez confirmed that her department has been speaking to Uber about the application process.

“Uber hasn’t formally submitted their autonomous vehicle tester program application,” Gonzalez wrote in an email, “but just as we would with any other manufacturer, the DMV is providing assistance with the steps necessary to apply for and receive a test permit.”

Uber rolled out a fleet of self-driving cars in San Francisco in January, without first obtaining the $150 permit California requires for companies testing autonomous vehicles on public roads. The move sparked an immediate outcry from the DMV, former Attorney General Kamala Harris and San Francisco Mayor Ed Lee, as well as public safety advocates. Uber refused to bow to their demands, claiming it didn’t need the permit because its cars always had drivers behind the wheel ready to take control.

After a contentious, week-long back and forth between Uber and state regulators, the DMV revoked the cars’ registrations, forcing Uber to shut down the program. Uber then shipped its self-driving cars to Arizona, where they started picking up passengers last week.

Uber on Thursday said it hasn’t changed its position on what constitutes a self-driving car.

The DMV already has issued temporary operating permits for two of Uber’s banished autonomous Volvos, Gonzalez said. Those cars are back on the road in San Francisco, but will not go into self-driving mode until the permit is issued, an Uber spokeswoman said. The company previously received the OK from the DMV to drive five of the cars around San Francisco for mapping purposes — with the self-driving features turned off.

If Uber receives a self-driving test permit, which the DMV says can take less than 72 hours, the ride-hailing company will have to report all autonomous vehicle accidents resulting in damage or injury, as well as instances when the autonomous technology fails and a human operator takes the wheel.

John Simpson of Santa Monica-based advocacy organization Consumer Watchdog, which has been critical of Uber’s self-driving car program, said he’s glad the company has agreed to follow the rules.

“I think there are signs that maybe the company is beginning to get it,” he said, “and possibly they’re starting to grow up.”

Simpson tied the move to Kalanick’s promise Tuesday to get “leadership help.” In an email to employees later published on Uber’s blog, Kalanick apologized for arguing with an Uber driver about wages in a video that went viral earlier that day. The video was the latest in a string of publicity nightmares for the company, which began last month when a former engineer accused Uber of failing to respond to sexual harassment within the company.

Uber also is facing questions about the self-driving trucks it acquired when it bought autonomous trucking startup Otto in August. California doesn’t allow testing of autonomous trucks on public roadways — with or without a permit. But in early February, Consumer Watchdog complained to the DMV that Otto was testing its trucks in California in violation of the law. The group cited a document obtained from transportation officials in Colorado, in which Otto appears to refer to self-driving tests performed on California roads.

Otto has said its trucks do not break the law because a driver is in control at all times — similar to Uber’s original argument about its self-driving Volvos.

The DMV and California Highway Patrol met with Otto last week, and both agencies plan to follow up with a visit to Otto’s truck terminal in the near future.

“At this time,” Gonzalez wrote in an email, “(the) DMV is comfortable with the explanation and the conversations we have had with Otto about their trucks.”