Google on Monday fired the employee who wrote an internal memo suggesting men are better suited for tech jobs than women, escalating a debate over free speech at the company.

Google Chief Executive Sundar Pichai said in an email to his staff that the employee’s memo violated company policy. Google, part of Alphabet Inc., didn’t publicly name the memo’s author.

Software engineer James Damore, who said in an email that he wrote the memo and was fired for it, said he was considering legal action against Google for firing him after he complained to federal labor officials about executives’ alleged efforts to silence him.

Mr. Damore published an internal memo last week that criticized Google’s efforts to increase diversity at the company, arguing the program discriminated against some employees. He said men were generally better at engineering jobs than women and a liberal bias among executives and many employees made it difficult to discuss the issue at Google.

The memo went viral inside the company, which spilled into public view when Google employees publicly criticized it and eventually leaked it to the media. The controversy posed a thorny question for one of the world’s largest companies, one that espouses free speech: How would it handle an employee who offered opinions that were, to many inside the company, offensive?