Elon Musk is suing OpenAI and its CEO Sam Altman over what he says is a betrayal of the ChatGPT maker’s founding aims of benefiting humanity rather than pursuing profits.

In a lawsuit filed at San Francisco Superior Court, billionaire Musk said that when he bankrolled OpenAI’s creation, he secured an agreement with Altman and Greg Brockman, the president, to keep the AI company as a nonprofit that would develop technology for the benefit of the public.

Under its founding agreement, OpenAI would also make its code open to the public instead of walling it off for any private company’s gains, the lawsuit says.

However, by embracing a close relationship with Microsoft, OpenAI and its top executives have set that pact “aflame” and are “perverting” the company’s mission, Musk alleges in the lawsuit.

OpenAI declined to comment on the lawsuit Friday.

“OpenAI, Inc. has been transformed into a closed-source de facto subsidiary of the largest technology company in the world: Microsoft,” the lawsuit filed Thursday says. “Under its new Board, it is not just developing but is actually refining an AGI to maximize profits for Microsoft, rather than for the benefit of humanity.”

AGI refers to artificial general intelligence, which are general purpose AI systems that can perform just as well as — or even better than — humans in a wide variety of tasks.

Musk is suing over breach of contract, breach of fiduciary duty and unfair business practices. He also wants an injunction to prevent anyone, including Microsoft, from benefiting from OpenAI’s technology.

Those claims are unlikely to succeed in court but that might not be the point for Musk, who is getting his take and personal story on the record, said Anupam Chander, a law professor at Georgetown University.

“Partly there’s an assertion of Elon’s founding role in OpenAI and generative AI technology, in particularly his claim he named OpenAI and he hired the key scientist and that he was the primary funder of its early years,” Chander said. “In some sense it’s a lawsuit that tries to establish his own place in the history of generative AI.”

Musk was an early investor in OpenAI when it was founded in 2015 and co-chaired its board alongside Altman. In the lawsuit, he said he invested “tens of millions” of dollars in the nonprofit research laboratory.

Musk resigned from the board in early 2018 in a move that OpenAI said at the time would prevent conflicts of interest as the Tesla CEO was recruiting AI talent to build self-driving technology at the electric car maker. “This will eliminate a potential future conflict for Elon,” OpenAI said in a February 2018 blog post. Musk has since said he also had disagreements with the startup’s direction, but he continued to donate to the nonprofit.

Later that year, OpenAI filed papers to incorporate a for-profit arm and began shifting most of its workforce to that business, but retained a nonprofit board of directors that governed the company. Microsoft made its first $1 billion investment in the company in 2019 and the next year, signed an agreement that gave the software giant exclusive rights to its AI models. That license is supposed to expire once OpenAI has achieved artificial general intelligence, the company has said.

Its unveiling of ChatGPT in late 2022 bought worldwide fame to OpenAI and helped spark a race by tech companies to capitalize on the public’s fascination with the technology.

When the nonprofit board abruptly fired Altman as CEO late last year, for reasons that still haven’t been fully disclosed, it was Microsoft that helped drive the push that brought Altman back as CEO and led most of the old board to resign. Musk’s lawsuit alleged that those changes caused the checks and balances protecting the nonprofit mission to “collapse overnight.”

One of Musk’s claims is that the directors of the nonprofit have failed to uphold their obligations to follow its mission, but Dana Brakman Reiser, a professor at Brooklyn Law School, is skeptical that Musk had standing to bring that claim.

“It would be very worrisome if every person who cared about or donated to a charity could suddenly sue their directors and officers to say, ‘You’re not doing what I think is the right thing to run this nonprofit,’” she said. In general, only other directors or an attorney general, for example, could bring that type of suit, she said.

Even if Musk invested in the for-profit business, his complaint seems to be that the organization is making too much profit in contradiction to its mission, which includes making its technology publicly available.

“I care about nonprofits actually following the mission that they set out and not being captured for some kind for profit purpose. That is a real concern,” Brakman Reiser said. “Whether Elon Musk is the person to raise that claim, I’m less sure.”