Microsoft President Brad Smith drew lessons from the software giant’s “gut wrenching” antitrust battles of the late 1990s that seem to resonate today, as Facebook faces scrutiny of its data privacy practices by regulators in the U.S. and Europe.

“If you create technology that changes the world, the world is going to want to govern you, it’s going to want in some measure to regulate you,” Smith said today, in the opening day of the Code Conference on Rancho Palos Verdes. “You have to come to terms with that.”

Microsoft was cast as a monopolist for its command of the software operating 90% of the world’s computer desktops in 1998, when antitrust regulators accused it of anticompetitive practices in its bundling of the Internet Explorer browser as part of its operating system — placing the rival Netscape browser at a disadvantage.

Smith said Microsoft spent years fighting the government until it exhausted its appeals and a consent decree was reached in 2002. He suggested that Microsoft might have benefitted from striking a more conciliatory approach, “before it became the antitrust version of nuclear war.”

As Microsoft founder Bill Gates and senior executives Steve Ballmer spent time preparing for depositions, the single greatest cost was the distraction, Smith said. The all-consuming legal process took a toll in terms of missed opportunities.

“We missed search,” said Smith. “One has to have the recognition that no one is going to see every trend. Would we have seen these things if we had spent more of our time looking for them? The odds of seeing these things would have been higher.”

Smith touched on a variety of issues in his conversation, including immigration, digital inclusion. Immigration is a critical issue for the tech sector, which relies heavily on visas to attract highly skilled workers. He said Microsoft will stand beside employees who might be faced with deportation — even if that means, going to court to fight on their behalf.

“I think it’s important that, as much as possible, this industry stick together,” Smith said. “It means using our voice, using our lawyers, it may mean standing behind our employees” even if that means moving them to Canada, to remain on the payroll.

Under his tenure as president and chief legal officer, Smith has been a fierce advocate for privacy.

Microsoft sued the government for the right to tell its customers when a federal agency is looking at their emails. It argued, in a suit filed in 2016, that the government is violating the Constitution by preventing Microsoft from notifying people when the government wants to peer at their private correspondence. It withdrew the suit after the government agreed to limit its use of gag orders when it obtains warrants.

Microsoft took another digital privacy case all the way to the U.S. Supreme Court. At issue was how U.S. prosecutors could access data held on overseas computer servers owned by U.S. companies. The case involved a challenge to a domestic warrant for emails stored on a server in Dublin that related to a drug-trafficking investigation.

The high court dropped the case in April after Congress passed legislation that resolved the dispute (companies now have an avenue to object if the government’s request conflicts with foreign laws).

Smith joined Microsoft in 1993, and was named general counsel in 2002. He spent three years leading the legal and corporate affairs team in Europe, then five serving as deputy general counsel responsible for teams outside of the U.S. He was elevated to president in 2015.