When Sundar Pichai was named Google CEO in 2015, his predecessor said Pichai would work to "stretch boundaries" for the company's products.

But this week, Pichai had a different challenge: setting boundaries for the company's employees.

On Monday, Pichai cut his family vacation overseas short to address an anti-diversity memo from a Google (GOOGL) employee that went viral among staffers over the weekend. The memo argued women are biologically unfit for tech roles.

In an email to Google employees Monday night, Pichai condemned parts of the memo as "offensive" and violated the company's Code of Conduct.

"Our job is to build great products for users that make a difference in their lives," Pichai wrote. "To suggest a group of our colleagues have traits that make them less biologically suited to that work is offensive and not OK."

With that email, Pichai earned praise from many in the industry. Ellen Pao, who fought a high-profile gender bias case against her former venture capital firm, praised Pichai for making "the right call."

But Pichai also plunged himself into a divisive debate raging inside Google over free speech and a culture war raging outside the company.

Related: Google CEO: Anti-diversity memo was 'offensive and not OK'

The front page of Breitbart, a far-right website, was flooded with stories about the Google incident overnight Monday, including one that said the memo's author was being punished for "criticizing left-wing intolerance." On Twitter, some described Pichai's actions as "totalitarian."

The controversy offers perhaps the biggest test yet for Pichai's leadership.

He took over as Google's CEO two years ago this month amid a corporate restructuring. Larry Page, Google's cofounder and previous CEO, became CEO of Google's newly created parent company, Alphabet.

Pichai may not be as well known as Google's founders. He isn't necessarily a household name in the mold of other tech titans like Facebook (FB) CEO Mark Zuckerberg, Amazon (AMZN) CEO Jeff Bezos and Apple (AAPL) CEO Tim Cook. But as Google's top exec, he wields a tremendous amount of influence.

Pichai oversees a company with tens of thousands of employees, tens of billions in revenue and products that reach billions (yes, with an "s") of users. Google also has an outsized influence on corporate culture.

Pichai, born in India, rotated through a number of executive positions Google over the course of a decade. He helped build Chrome into a top web browser. He oversaw Android, which now has two billion monthly users. Pichai eventually took charge of all software products.

Related: Sexual harassment in tech: Women tell their stories

In his time as Google CEO, he has pushed the company deeper into hardware, cloud computing and artificial intelligence. Some of these efforts are beginning to pay off in helping Google make money beyond advertising.

But technical innovation is only one part of Pichai's role now. He must also balance a company culture that prizes free speech with the reality that the entire tech industry is under a microscope right now for a lack of diversity and mistreating women.

If that's not enough, Pichai faces a more sensitive political landscape than either of his two predecessors.

Pichai took over as CEO shortly after President Trump launched his campaign. Since then, Pichai has weighed in on political issues like Trump's travel ban, withdrawal from the Paris Agreement, and the proposed transgender military ban.