The two men “were ostracized, belittled and punished for their heterodox political views, and for the added sin of their birth circumstances of being Caucasians and/or males,” Harmeet K. Dhillon from the Dhillon Law Group, the lead attorney for the plaintiffs, said in the lawsuit. “Google’s open hostility for conservative thought is paired with invidious discrimination on the basis of race and gender.”

Silicon Valley, often considered a bastion for liberal thinking, has been wrestling with how to deal with the culture wars that have reverberated throughout the country. At the same time, technology firms are trying to address the shortage of women and minorities in their ranks.

Those issues are coming to a head at Google, one of the richest and largest technology companies in the world. Google is also fighting a pay discrimination lawsuit brought by four women who worked at the company. The women claim that Google systematically pays women less than men to do the same jobs.

Mr. Damore’s memo last year argued that biological differences — citing greater levels of anxiety among women, and a lower tolerance for stress — helped explain why there were fewer women in key engineering positions and leadership roles at Google. His writing sparked outrage at the company and across Silicon Valley for rationalizing the pay and opportunity gap at technology companies.

Mr. Damore’s dismissal became a rallying point for conservatives who saw technology companies as workplaces dominated by groupthink. Ms. Dhillon, the lawyer who brought the suit, is a committeewoman for California in the Republican National Committee.