Embattled electric carmaker Tesla is laying off more than 4,000 workers — 9 percent of its workforce — in its push for profitability, CEO Elon Musk confirmed on Tuesday.

Musk posted the details of the "difficult, but necessary Tesla reorg" on his Twitter feed, laying out the reasoning in a letter that he sent to all employees.

“To ensure that Tesla is well prepared for the future, we have been undertaking a thorough reorganization of our company,” CEO Musk said in the letter.

Difficult, but necessary Tesla reorg underway. My email to the company has already leaked to media. Here it is unfiltered: pic.twitter.com/4LToWoxScx — Elon Musk (@elonmusk) June 12, 2018

Exactly how the layoffs will take effect is uncertain, but Tesla’s workforce grew to around 30,000 with the acquisition of Solar City. The impact will focus on salaried staff, Tesla confirmed, with the company noting that no production associates at its assembly plant in Fremont, California, and Gigafactory in Reno, Nevada will be affected. If anything, Tesla has been increasing its line count in its push to drive up production of the Model 3 battery-electric sedan.

The exact reason for the reorganization and layoffs has been a matter of debate. Tesla last month indicated its goal was to streamline the company and, in the process, address the sort of problems that have routinely resulted in delays in its product programs.

“Frankly, I’m not surprised” by the latest news, Navigant Research senior analyst Sam Abuelsamid told NBC News. “Musk has made some big promises… and I expect he will have to take even more steps to cut costs."

The news came just one day after Musk said his company is getting ready to roll out a “fully self-driving” version of its Autopilot system by August, despite increasing concerns about the safety of the current technology.

In a late Monday tweet, Musk noted that, "to date, Autopilot resources have rightly focused entirely on safety (but) with V9, we will begin to enable full self-driving features."

The expanded capabilities, which will come as part of a vehicle software update known as Version 9, should be uploaded to vehicles in August, Musk wrote.

That issue is better in latest Autopilot software rolling out now & fully fixed in August update as part of our long-awaited Tesla Version 9. To date, Autopilot resources have rightly focused entirely on safety. With V9, we will begin to enable full self-driving features. — Elon Musk (@elonmusk) June 10, 2018

The idea of letting owners of Tesla Models S, X, and 3 operate their vehicles entirely hands-free has been something Musk has been promising for several years. His comments Monday echoed with shareholders as well as owners, with Tesla stock surging in after-hours trading. But his latest announcement is likely to generate concern among critics who point to a series of recent accidents, including one fatal, linked to Autopilot.

It is unclear exactly what Tesla has planned for Version 9. Musk has not indicated whether it will allow limited hands-free operation on well-marked freeways — in line with systems now offered by competitors such as Cadillac and BMW — or permit even more extensive operation without driver intervention.

There are five levels of autonomous technology, according to widely accepted industry standards. These range from Level 1 systems that can help stabilize a vehicle in conditions of reduced traction, up to Level 5 technology in which no driver is needed in the vehicle.

The current version of Autopilot is considered Level 2, meaning it can keep up with the flow of traffic without the driver using gas or brakes, while also helping hold the vehicle within its lane. But while Tesla has lately made a point of stressing that drivers still must keep hands on the wheel and be ready to intervene in an emergency, many owners apparently believe Autopilot is much more capable.

Critics, including Washington, D.C.-based Center for Auto Safety and California’s Consumer Watchdog, contend that the very name, “Autopilot,” can lead owners to believe the system already has fully hands-free capabilities. The two groups are petitioning the Federal Trade Commission, as well as California regulators, to ban the use of that name.

While Tesla insists that its own research shows owners understand the limits of the current Autopilot system, critics note a stream of early videos posted by Tesla owners showing them operating their vehicles hands-free — one owner even climbed into the back seat as the car raced down a freeway.

Even as Musk promises what would likely be a major upgrade, Autopilot has come under close scrutiny.

In March, 38-year-old Walter Huang was killed when his Model X slammed into a California highway barrier and then hit two other vehicles before bursting into flames. In a preliminary finding from an ongoing probe, the National Transportation Safety Board determined that “for the last 6 seconds prior to the crash, the vehicle did not detect the driver’s hands on the steering wheel,” even though the system alerted Huang to regain manual control.

The driver involved in a subsequent crash in Utah also was found to have been operating with her hands off the wheel when the vehicle crashed into a parked fire truck. There are indications the Autopilot system did not warn her of an impending collision, however. That motorist survived with relatively modest injuries.

Tesla previously claimed it would take steps to resolve problems with Autopilot after a May 2016 crash that killed a former Navy SEAL. The NTSB faulted the driver for failing to remain vigilant while operating in semi-autonomous mode, but also cited Autopilot for its inability to distinguish between the truck that turned into the Tesla sedan’s path and a bright Florida sky.

Tesla subsequently updated both its Autopilot hardware and software. But critics question whether it has gone far enough to allow true “self-driving capabilities." In particular, Tesla vehicles use only camera and radar sensors, not the advanced, 3D LIDAR sensors used by virtually all other carmakers and tech firms developing autonomous vehicles. Competitors insist that this high-definition laser technology is needed to allow a vehicle to operate with at least the skills of a human driver.

Musk’s tweet did not say when he or the company would provide more details about the Version 9 update to Autopilot.