AP Technology Writer

SAN FRANCISCO (AP) _ Microsoft is cutting 7,800 jobs and writing off $7.6 billion in connection with its purchase of Nokia’s phone business, as the giant software maker tries to narrow its focus and pull back from a series of ill-fated forays onto rival tech companies’ turf.

The cuts announced Wednesday come on top of 18,000 jobs that Microsoft trimmed last year, just months after the company paid $7.3 billion for Nokia in the hope of expanding its footprint in the smartphone hardware business where Apple and Samsung are market leaders.

Three years ago, Microsoft wrote off another big sum, $6.2 billion, on its purchase of digital advertising firm aQuantive. Microsoft bought aQuantive for $6.3 billion in a bid to increase its role in the online ad sector that was dominated by the likes of Google and Yahoo.

Both the Nokia and aQuantive deals were engineered by former CEO Steve Ballmer, who sought to compete against younger, faster-growing tech companies by expanding beyond Microsoft’s original business of making software for desktop computers.

But Microsoft’s new boss, Satya Nadella, has been pulling back from phone hardware and digital advertising after seeing weak returns on those ventures. Last month, he announced a deal to hand over most of Microsoft’s remaining display advertising business to AOL Inc.

Wall Street seems to prefer Nadella’s strategy of focusing on software and Internet services. Analysts have said the Nokia business was a drag on Microsoft’s profits. After seeing a slight rise in the morning, Microsoft shares closed Wednesday at $44.24, down 6 cents on a day when a number of tech stocks saw declines.

“We believe these cuts are positive for Microsoft as they help streamline the business by getting rid of non-core components,” said Mark Moerdler, an investment analyst with Bernstein Research, in a note to investors.

“The new CEO has got to right the ship,” agreed David Mitchell Smith, an industry analyst with the Gartner research firm. “They were heading in some directions that needed course correction, and he’s doing it.”

That doesn’t mean Microsoft is out of the woods. The Redmond, Washington, company has struggled to adapt as consumers have increasingly turned away from personal computers, in favor of smartphones and tablets that run software made by Apple and Google.

Analysts say Nadella is making a big bet that people will use new versions of Microsoft’s software on a wide variety of computing devices _ including tablets, video game consoles and even holographic headsets. In recent months, Microsoft has released new versions of its popular Office software for Apple and Android devices, while preparing to launch a major overhaul of its flagship Windows operating system at the end of this month.

“Our reinvention will be centered on creating mobility of experiences across the entire device family including phones,” Nadella wrote in an email to employees that sought to explain the latest cuts.

Microsoft isn’t getting out of the hardware business altogether, although Nadella said the company will no longer focus on building a “stand-alone phone business.” He said Microsoft will make a smaller number of phones for business users, low-cost models for “value” buyers and “flagship devices” for Windows fans.

The company also makes Surface tablets and Xbox consoles, and plans to sell its new HoloLens augmented reality headsets.

When added to last year’s layoffs, Microsoft will have trimmed roughly the number of employees it added when it acquired the Nokia business. Microsoft said it had 118,000 workers at the end of March.

While he did not provide specifics, Nadella said the latest cuts will primarily affect the Nokia phone business, which has several thousand workers in Finland. The operation has struggled for profitability and seen little growth in its share of the global phone market.

Along with writing down the value of that business, Microsoft Corp. said it will incur $750 million to $850 million in restructuring costs related to the cuts.

Wednesday’s announcement was not entirely a surprise. Nadella has warned in recent months that the company would have to make “some tough choices in areas where things are not working.”