– Microsoft built its fortune making the tools of technology that billions use every day.

But the company’s president, Brad Smith, has increasing misgivings about how thieves, terrorists and scoundrels have weaponized those tools, and how the industry has failed too often to thwart them.

He chides Facebook for allowing influence campaigns to flourish on the network that helped elect Donald Trump president in 2016. And he argues that social media companies can’t profit from hatemongers posting vile content while brushing off responsibility.

“Digital technology has become both a tool and a weapon, and we need to address that head on,” Smith said in an interview at Microsoft headquarters. “And part of addressing it head on starts with really understanding the different ways in which it’s either serving humanity or being weaponized.”

Smith lays out his critique in his forthcoming book, “Tools and Weapons: The Promise and the Peril of the Digital Age.” Co-written with Microsoft communications executive Carol Ann Browne, the book examines the missteps tech companies have made and suggests new approaches for the industry as threats to privacy, cybercrime and disinformation mount.

The book, which became available Tuesday, arrived after a tough summer for tech’s titans.

Facebook was hit with a $5 billion fine in July for repeatedly deceiving its 2.2 billion users and undermining their privacy choices. The European Union launched an antitrust investigation into whether Amazon is misusing its dual role as both a marketplace for independent sellers and a retailer of its own products. And last week, Google’s YouTube agreed to pay out $170 million to settle allegations that it illegally collected data about children younger than age 13.

But Microsoft — the only tech company still valued over $1 trillion — has recently managed to dodge hefty fines and nasty rhetoric from lawmakers and regulators in the United States.

It’s in stark contrast from two decades ago, when Microsoft was tech’s biggest bully and the subject of onerous litigation brought by the U.S. trustbusters and investigations by competition czars around the world.

Smith acknowledges being part of the problem back then.

“We made more than our share of mistakes in the antitrust era, and I was personally responsible for almost all of them, to some degree,” he said in the interview.

Since then, he said, Microsoft has matured and internalized lessons that younger tech companies may still need to learn.

Microsoft “was knocked off its perch in part because it had not figured out how to come to terms with the responsibilities it then had,” Smith said. “But it’s also a story of a company that, then, ultimately learned from it and was able to internalize the need for those changes and succeed anew, but with more self-restraint than it would have ever exercised in the 1990s.”

In this new era of tech skepticism, Smith and his boss, Chief Executive Satya Nadella, have attempted to position Microsoft as a defender of its customers’ privacy and an advocate for government regulation of facial-recognition technology.

“Microsoft has become the model of responsibility among the tech giants,” said Michael Cusumano, a professor at the Massachusetts Institute of Technology’s Sloan School of Management and co-author of “The Business of Platforms: Strategy in the Age of Digital Competition, Innovation, and Power.” “It’s very different than what Microsoft was.”

Even so, Smith admits to recent missteps. Online news site Motherboard reported last month that Microsoft contractors have listened to personal conversations of Skype users conducted through the app’s translation service. Microsoft has said that it may use conversations to improve its service, but it did not make clear that people might eavesdrop to do so.

While the issue was “more nuanced” than it was portrayed, “we all make mistakes,” Smith said.

In his book, Smith takes Facebook to task. Russia weaponized the social network’s platform, using it to spread disinformation to influence the 2016 election.

“Facebook had not designed its services as a platform for foreign governments to use to disrupt democracy, but neither had it put in place measures that could prevent or even recognize such activity,” Smith wrote.

He wrote that the Cambridge Analytica scandal — in which Facebook’s privacy systems failed to detect the harvesting of users’ personal data in violation of its own policies — was “the type of issue that draws plenty of criticism but leaves the company with no real defense.”

Facebook spokesman John Pinette declined to comment on the book.

Smith grew up in Wisconsin before earning a bachelor’s degree at Princeton University and his law degree from Columbia Law School. He joined Microsoft in 1993 and is the longest-tenured member of the software giant’s senior leadership group.

Microsoft co-founder Bill Gates and former Chief Executive Steve Ballmer selected Smith to serve as the company’s general counsel in 2002 — following the company’s settlement with the government over abusing its Windows monopoly — with a mandate to make peace with governments and an industry it had spent much of its life alienating.

Smith helped broker settlements, shelling out billions of Microsoft’s dollars to such adversaries such as AOL Time Warner and Sun Microsystems.

And he oversaw Microsoft’s compliance with the settlement agreement that ended the federal government’s antitrust litigation against it, and required the company to, among other concessions, give computer makers more freedom to include rival software on their PCs.