With Apple facing what may be one of its most challenging periods in a decade, it would certainly be understandable if Apple CEO Tim Cook put his head down and just focused on products.

Instead, Cook has continued to elevate his public profile by tackling political and social causes in a way that stands in stark contrast to his predecessor, Steve Jobs, who was legendarily apolitical. And beyond just embracing these issues, Cook has often been the first tech executive into the breach, with Apple’s Silicon Valley brethren following in his wake.

The hand-to-hand combat between Apple and the FBI is a perfect example of Cook’s willingness to take a strong public stand. The company is waging both a legal and public relations battle over an issue that doesn’t just affect Apple, but potentially almost every tech company and, indeed, the fundamental relationship between citizens and the government.

Of course, the U.S. government has accused Apple and Cook of being motivated by purely economic and business interests. But Cook has again managed to hit square on the nose the broader issue facing society: How far can the government invade our privacy in the name of fighting terrorism?

To be sure, it would have been quite simple for Apple to quietly give the government what it wanted from the San Bernadino shooter’s iPhone. Chances are high that the public would have been none the wiser. And if anything had been leaked, Apple could have spun the situation like any company with a mighty public relations army.

But it didn’t. It took a stand.

“Opposing this order is not something we take lightly,” Cook wrote in a letter to customers last month. “We feel we must speak up in the face of what we see as an overreach by the U.S. government.”

Heir to Packard and Hewlett legacy

Now, four-and-a-half years into Cook’s tenure as CEO, we can see his actions as part of a clear pattern. And this stance doesn’t just separate Cook from Jobs. It’s hard to think of any tech CEO, or even any executive, who has been willing to be this politically and socially active. For most companies, being “politically active” usually translates into political action committees and lobbying for favorable legislation.

In Silicon Valley, it’s also worth saluting Salesfore.com CEO Marc Benioff. He’s been quite outspoken about the impact of the tech industry on the residents San Francisco, was early to build charitable and social principles into his company’s core, and certainly stood up to a number of states over their proposed anti-gay rights stands.

But with all due respect to Benioff, his company and his stature aren’t at a level to match Cook’s, or Apple, the world’s most valuable company. To find someone with that kind of global standing in Silicon Valley, you might have to reach back to the founders of HP: David Packard and William Hewlett.

The pair was a civic-minded force back in an era when companies and corporate chiefs still had the crazy idea that the point of a thriving business was to benefit people and communities. They took leadership positions on local Silicon Valley issues, and Packard founded the Silicon Valley Leadership Group in 1978, bringing companies together to tackle issues like housing and traffic and education.

Cook seems the true heir to their public spirit, though without their specific focus on local issues.

He started walking this path almost right from the start. He was appointed CEO in August 2011, less than two months before Jobs would pass away. Six months into his tenure, Cooke took a remarkable public tour of Chinese factories amid growing criticism of Apple’s labor practices.

It was a shock to see an Apple CEO out in public like that talking about anything that didn’t directly promote some great new gadget or service. And just a few weeks later, Cook took it one step further by announcing that Apple was working with the Fair Labor Association to raise standards and prevent abuses in the factories.

“My lifelong heroes are Martin Luther King and Bobby Kennedy,” he once said. “I get a lot of spears when I talk about this stuff. I don’t give a crap. This is something we care deeply about. I don’t think there’s a company on Earth that cares more deeply about human rights than Apple does.”

Now, it’s worth pointing out that in his previous role as chief operating officer, Cook built the massive supply chain that established Apple’s manufacturing system and drew the brunt of criticism. But again, it would have been easy enough to justify the situation and make a public relations push, rather than acknowledging the problem and trying to fix it.

That was just the beginning. In addition to looking at labor practices, Cook decided to put Apple front and center on environmental issues. One of his steps was to hire Lisa Jackson, former head of the U.S. Environmental Protection Agency, to be Apple’s vice president of environment, policy, and social initiatives. Beyond pushing Apple to a zero emissions goal, the fact that a high-ranking executive was focused on non-product social issues spoke volumes about Cook’s leadership and the direction of the company.

Gay rights as moral and business issue

Unlike Jobs, Cook regularly talks about Apple’s philanthropy, including the $100 million donation it made to a federal program that aims to bring more technology to low-income schools. And Apple regularly participates in efforts to raise money to fight the global spread of AIDS.

Of course, for many people, Cook’s most notable public stand came in 2014 when he wrote a column confirming that he is a gay man.

Cook is intensely private. And until then, he had rarely discussed his life outside of Apple in public. But that desire for privacy was outweighed by his belief that making such an announcement could benefit others. He noted that while there has been tremendous progress made by gay rights activists, gays and lesbians still face widespread cultural and legal discrimination.

“I don’t consider myself an activist, but I realize how much I’ve benefited from the sacrifice of others,” he wrote. “So if hearing that the CEO of Apple is gay can help someone struggling to come to terms with who he or she is, or bring comfort to anyone who feels alone, or inspire people to insist on their equality, then it’s worth the trade-off with my own privacy.”

Five months later, Cook was back to more forcefully bash a rising tide of anti-gay legislation in an op-ed for the Washington Post. He argued that such laws are both bad for business and a step backward morally.

“These bills rationalize injustice by pretending to defend something many of us hold dear,” Cook wrote. “They go against the very principles our nation was founded on, and they have the potential to undo decades of progress toward greater equality.”

The issue of taxes

To be sure, not every stand Cook has taken has won him adoration. For instance, in 2013, he and other Apple executives testified in front of Congress to defend the complex system of international tax schemes they use to reduce their tax bill.

“We pay all the taxes we owe — every single dollar,” Cook told Congress. “We don’t depend on tax gimmicks.”

Legal? Certainly. Civic-minded? Not so much. And in Europe, the company’s tax strategy has drawn fire and led to a pending investigation into Irish tax breaks claimed by Apple, which may have to pay substantial sums in back taxes.

But even here, Cook hasn’t hidden behind press releases or designated spokespeople. He feels strongly that Apple is in the right on this, and he hasn’t shied away from making that case publicly, no matter who might be displeased.

And he’s already proven that he isn’t afraid to make decisions on moral grounds, even if those choices don’t always boost Apple’s quarterly earnings.

In March 2013, I was in Cupertino for Apple’s annual shareholder meeting. After 18 months leading Apple, Cook had been feeling some heat from investors over the stock’s performance.

During the meeting, Justin Danhof, director of the National Center for Public Policy Research’s Free Enterprise Project, had criticized Apple for its connection to industry groups that believe global warming is caused by human activity.

At one point, Danhof confronted Cook and asked him to commit to only taking on projects that help the environment or fulfill other social justice aims if they directly benefit Apple’s bottom line.

Cook, clearly trying to remain calm, shot back: “When we work on making our devices accessible by the blind, I don’t consider the bloody ROI [return on investment]. When I think about doing the right thing, I don’t think about an ROI.”

Cook then offered his own bottom line to Danhof, or any other critic, one which perfectly sums up his belief that social and political and moral leadership are not antithetical to running a business.

“If that’s a hard line for you,” Cook continued, “then you should get out of the stock.”