SAN FRANCISCO — A federal judge ruled Tuesday that OpenAI’s nonprofit charter is a binding contract, ordering the company to immediately cease for-profit operations and give its technology to humanity for free.

“A pledge is a pledge,” Judge Rebecca Henderson wrote.

The ruling threatens to upend the tech industry, where mission statements are traditionally treated as promotional material.