Gender equality advocates largely applauded Google’s decision Monday to fire a software engineer who wrote a memo suggesting women were biologically less suited to coding jobs. But some, including many conservatives, saw the decision as something else: a politically motivated firing that raised concerns about free speech and the free flow of ideas.

"It is getting more difficult by the day to have a rational public conversation about anything," wrote Alexandra DeSanctis for National Review.

On the surface, Google appears to be on safe legal ground, at least when it comes to the firing: US workers don't have free speech rights in private sector jobs under the First Amendment. And Google can basically fire employees for whatever reason it wants to — James Damore, the employee who wrote the memo, was fired for violating the company's code of conduct by "perpetuating harmful gender stereotypes.”

Most US companies hire employees at will, which means either party can end the relationship with no explanation. There are a few exceptions, such as firing someone based on their race or gender, or in retaliation for filing workplace complaints with government agencies.

"Sometimes Americans think they have more rights at work than they actually do," said Angela Cornell, an employment law professor and director of the Labor Law Clinic at Cornell University. "But a manager can fire you because they don’t like your hair or because they want to hire their sister. You can be fired for any reason or no reason."

That's not the case for unionized workers. Under collective bargaining agreements — and in some job contracts — an employer can only fire someone for "cause." This means they have to prove that the employee was a bad worker or behaved badly.

Still, even if Damore was hired at will, it doesn't mean he has no legal protections. Before Google fired him, he filed a complaint with the National Labor Relations Board, saying the company was trying to “silence” his complaints. If he can prove that Google fired him as retaliation for the complaint, labor experts said, he might be able to sue.

But Google had discrimination concerns of its own. Right now, the company is fighting a gender discrimination lawsuit alleging that the company routinely pays women less money than men in the same types of jobs. By choosing to fire Damore, Google was essentially protecting itself from more criticism and potential future lawsuits.

Damore’s memo started a firestorm inside and outside Google

In the 10-page memo, which Damore published internally last week, he argued that Google's efforts to increase diversity discriminated against other employees, and that the company was not open to conservative political viewpoints.

But the most inflammatory part of the document was his suggestion that men are better suited to engineering jobs than women, largely based on biological differences, including that women are more prone to “neuroticism.” The memo was leaked to the media and first published Saturday by Gizmodo. Here are a few of his unfounded claims:

Women, on average, have more ... openness directed towards feelings and aesthetics rather than ideas. Women generally also have a stronger interest in people rather than things, relative to men (also interpreted as empathizing vs. systemizing). ... These two differences in part explain why women relatively prefer jobs in social or artistic areas.

Within hours of the memo’s release to the press, Google's head of diversity and inclusion, Danielle Brown, denounced the memo in an email to employees. "I found that it advanced incorrect assumptions about gender ... it’s not a viewpoint that I or this company endorses, promotes or encourages," she wrote.

By Monday, the company had decided to fire Damore. In a note to employees, CEO Sundar Pichai said it was fair for Damore to question the effectiveness of Google's diversity programs and bias training, as well as the perceived censorship of unpopular political views. But he added that Damore crossed the line:

To suggest a group of our colleagues have traits that make them less biologically suited to that work is offensive and not OK. It is contrary to our basic values and our Code of Conduct, which expects “each Googler to do their utmost to create a workplace culture that is free of harassment, intimidation, bias and unlawful discrimination.”

Damore disagrees. He told the Wall Street Journal that he believed his firing was politically motivated. That's why, right before he was let go, he filed a complaint with the National Labor Relations Board “about how Google’s upper management is misrepresenting and shaming me in order to silence my complaints.”

Damore might have a legal case

Several legal experts I spoke to say Damore may have grounds to challenge his dismissal, but not based on his argument that he was fired for his political views.

Employees who file complaints with the NLRB are protected from being fired for retaliation. It's possible that Damore could prove Google executives fired him because he filed the complaint, said Jeffrey Hirsch, an employment law professor at the University of North Carolina.

"That's classic retaliation," said Hirsch. "But then Google will probably say, 'We didn't fire you because of the complaint; we fired you because your memo was a bomb for our workplace culture.'"

Damore may also have a more tenuous claim under the National Labor Relations Act, which protects employees who are making a concerted effort to change workplace policies. A common example is a worker who talks to colleagues about pushing managers to implement higher safety standards. While Damore wasn't asking for improved safety measures, he may have talked to colleagues about how to make the company's diversity programs more fair. If he was fired because of those efforts, then he still might have a case.

"He has a right to communicate with others about things like wages and hours and working conditions," said Samuel Estreicher, a law professor at New York University and director of the university's Center for Labor and Employment.

These are just claims he could make at the federal level. The state of California has more labor protections, including a right to privacy in the workplace. The state courts have also challenged at-will firings if they violate a company's workplace policies.

But the truth is companies that hire employees at will have far more leeway in firing decisions. Companies that sign collective bargaining agreements with unions, on the other hand, usually cannot fire an employee without "cause,” meaning they would need to show that they were bad workers or behaved badly.

If Damore were unionized and disputed his firing, he likely would have had a union representative take his case to arbitration. As part of that process, an independent arbitrator would resolve the dispute without going through the court system.

Engineers at Google are not unionized. And employers’ general freedom to fire at-will workers means the question of whether to fire Damore was likely more about public relations than employment law. Would employees view this as censoring an unpopular view, or harming efforts to make Google an inclusive environment for women and minorities?

"They were going to tick off one group of employees one way or the other," Hirsch said. "Because a majority have concerns about diversity, [their decision] was not really a surprise."