Just two weeks ago, Microsoft’s Satya Nadella took the stage alongside OpenAI’s Sam Altman at the startup conference in a former concert hall in San Francisco. Both were wearing black jeans, Mr. Altman in a military green shirt and Mr. Nadella in a navy blue casual suit.

“We love you guys!” Mr. Nadella said as he turned to Mr. Altman.

“Awwww,” Mr. Altman responded.

Altman has called OpenAI’s relationship with Microsoft “the best bromance in tech.” Since 2019, the companies have worked together to build advanced artificial intelligence systems that they believe could be the most important technological innovations in a generation, and Microsoft has invested $13 billion in OpenAI. Together, they planned to take on Google’s hammer on the Internet.

That relationship is being tested. On Friday, when the nonprofit board that controls OpenAI fired Altman, the company’s co-founder and CEO, Microsoft received just a few minutes’ warning before the move became public.

Over the past three days, Nadella has made it clear that he is not willing to abandon the partnership, but the future of OpenAI may be in doubt. And what could have been an embarrassing moment for Nadella and his company has turned into a show of corporate strength that has left industry insiders stunned.

Since OpenAI launched its ChatGPT chatbot almost a year ago, artificial intelligence has captured the public’s imagination, with hopes that it can be used for important work such as drug research or to help teach children. It could also lead to job losses or even autonomous war. And whoever builds it could control what some computer scientists believe is one of the most important new technologies since the steam engine.

On Sunday night, hours after OpenAI’s board said it stood by the decision to remove Altman, Microsoft swooped in to hire Altman and Greg Brockman, who resigned as president of OpenAI after the board’s decision. Nadella said the two would run a new AI research lab for Microsoft, and most of OpenAI’s more than 700 employees have said they will leave and offer their services to Microsoft if Altman is not reinstated.

“We look forward to acting quickly to provide them with the resources necessary for their success,” Nadella said. saying on X, formerly Twitter.

Microsoft and OpenAI declined to comment.

Nadella’s aggressive move against OpenAI was a surprising cap to a wild weekend. It exposed a gap between tech industry leaders focused on turning AI into a giant business and an increasingly influential part of the tech community that believes AI could be dangerous.

A key member of OpenAI’s board of directors believed that Altman was moving too quickly to expand his company without paying enough attention to the safety of AI, from concerns that it would eliminate jobs to believing that it could be a threat to the humanity.

Although Nadella and his company tried unsuccessfully to help solve OpenAI’s management problem over the weekend, he had more influence over the San Francisco startup than many people realized.

OpenAI most likely saw only a portion of the $13 billion Microsoft has committed because it was supposed to be paid over time, although the exact terms of the deal were unclear. In addition, Microsoft signed an agreement that provided it with copies of OpenAI’s most cutting-edge technology and has been working with it for more than a year. Microsoft has been providing OpenAI with the enormous computing power it needs to build its AI.

With all that, Nadella could rebuild OpenAI within Microsoft and not waste much time or money. It is also not out of the question that OpenAI’s board of directors could bow to employee pressure to bring back Altman and his allies, with significant changes to the board of directors. Mr. Nadella could live with that, too.

“It’s like you forget the nonsense that happened for four days: Sam is still Sam and he runs the show,” said S. Somasegar, a former Microsoft executive now with Madrona Venture Group and who has been in contact with Nadella. “Microsoft will end up winning no matter what happens here.”

For Microsoft, an implosion at OpenAI presented a major risk to its plans to integrate AI into everything it does. Microsoft owns 49 percent of OpenAI, but has no direct influence over its board of directors.

But as a protection against not having explicit control of OpenAI, Microsoft negotiated contracts that gave it rights to OpenAI’s intellectual property, copies of the source code of its key systems, as well as the “weights” that guide the system’s results after it has been trained. about data, according to three people familiar with the deal, who were not allowed to discuss it publicly.

“That’s Microsoft’s core protection,” Somasegar said.

Nadella acted quickly on Friday afternoon to speak with OpenAI’s board of directors in an attempt to defuse the tense situation. She said Microsoft would continue working with OpenAI, but it’s unclear what will remain of the company.

Microsoft investors, who feared that Microsoft would be put in a difficult situation by the OpenAI management disaster, applauded Nadella’s move. Microsoft’s stock price rose more than 2 percent on Monday to hit an all-time high.

Nadella and his chief technology officer, Kevin Scott, had close relationships with Altman and Brockman. Nadella and Altman have known each other since 2018, when they met at the Allen & Company High Voltage conference in Sun Valley, Idaho. At the time, OpenAI was a nonprofit research lab dedicated to building secure general artificial intelligence.

But OpenAI needed large amounts of expensive computing power, so to attract investors, it created a for-profit company still under the control of the nonprofit’s board of directors.

Since its first $1 billion investment in OpenAI in 2019, Microsoft has treated the much smaller company as a technology incubator. OpenAI was singularly focused on AI (like a pack of wolves, as one former Microsoft executive described it), while Microsoft had to manage a variety of businesses, from cloud computing and software to computer games.

OpenAI is now discovering that it needed Microsoft much more than Microsoft needed OpenAI. Microsoft developed and provided the enormous computing power that powers OpenAI and negotiated a series of legal and commercial agreements to protect it if something went wrong there.

Microsoft had spent months negotiating a $10 billion investment that closed in January and worked to keep its ownership stake at just under 50 percent. Among other things, it was concerned that having majority control would expose it to antitrust scrutiny, according to the three people familiar with the deal. And Nadella avoided meddling in the management of OpenAI.

The chaotic weekend showed that he didn’t need a board seat to have power.

The report was contributed by Cade Metz, Erin Griffith, mike isaac and Tripp Mickleall from San Francisco.