A majority of voters in a new poll says Google was wrong to fire an engineer for writing a controversial internal memo detailing why he believes the company has failed to attract more women in its workforce.

Fifty-five percent of those polled in the latest Harvard-Harris Poll survey said Google was wrong to fire James Damore, including 61 percent of Republicans, 56 percent of independents and 50 percent of Democrats.

Fifty-six percent of voters overall also said it sets a bad precedent to fire people for expressing their honest views about gender dynamics in the workplace. Seventy-one percent said that even if a worker expresses views that reinforce gender stereotypes, it should still be illegal to fire that person.

"The public overwhelmingly believes that it should be illegal to fire people for expressing their views," Harvard-Harris Poll polling co-directors Mark Penn and Stephen Ansolabehere wrote in an op-ed for The Hill on Monday.

"While America is divided on so many questions, a substantial majority of every single demographic group we track agreed with these propositions."

Earlier this month, Damore wrote a memo saying he supports Google's efforts to produce a more diverse workplace but that inherent differences between men and women might be the reason the company had spent hundreds of millions of dollars on diversity programs that have failed to attract more women.

Many media outlets deemed Damore's memo an "anti-diversity" or "sexist" screed, and he was fired for perpetuating "harmful gender stereotypes" amid the uproar.

Many on the right were furious with Google, saying the company bowed to politically correct culture and that the company claims to prioritize diversity but cannot handle a variety of political views.

The incident has raised concerns that Silicon Valley will use its enormous leverage over data and information to bury speech its leaders find offensive, an issue examined in the new poll.

Forty-five percent of those questioned said tech companies are fair to people with conservative views, while 43 percent said they are biased against conservatives.

Conversely, 46 percent said tech companies are fair to liberals, while 35 percent said they are biased in favor of liberals and only 18 percent believe they are biased against liberals.

A majority, 55 percent, also said they don't feel comfortable expressing their political views at work. Eighty-five percent believe workers should be protected from being fired for expressing their political views.

That extends to unpopular speech. Seventy-nine percent said it should be illegal to fire someone who expressed opposition to gay marriage and 60 percent said it should be illegal to fire someone for expressing racist views online or at a rally.

On the issue of affirmative action, 52 percent say they oppose giving minorities preference in hiring to add diversity, including 63 percent of whites. Eighty-four percent of blacks and 70 percent of Hispanics support those measures.

Broken down by political preference, 75 percent of Republicans and 55 percent of independents oppose programs that give minorities preference, while 70 percent of Democrats support them.

Meanwhile, 56 percent support those same programs if they're meant to give women preference in the hiring process.

An overwhelming majority, 81 percent, say hiring at big companies should be blind to gender and race.

The Harvard-Harris Poll online survey of 2,263 registered voters was conducted from Aug. 17 to 22. The partisan breakdown is 37 percent Democrat, 31 percent Republican, 29 percent independent and 3 percent other.

The Harvard-Harris Poll is a collaboration of the Harvard Center for American Political Studies and The Harris Poll. The Hill will be working with Harvard-Harris Poll throughout 2017.

Full poll results will be posted online later this week. The Harvard-Harris Poll survey is an online sample drawn from the Harris Panel and weighted to reflect known demographics. As a representative online sample, it does not report a probability confidence interval.