Shares of Tesla closed down 2.1 percent on Tuesday afternoon following news of a civil rights lawsuit against the automakers.

The proposed class-action suit alleges a racist culture at Tesla, unsafe factory conditions, and failure on the part of the company, including CEO Elon Musk personally, to prevent or investigate race-based harassment and discrimination there.

Filed on behalf of plaintiff Marcus Vaughn, an ex-Tesla worker, and more than 100 African Americans who worked at Tesla's Fremont factory between November 2016 and November 2017, the suit claims that Tesla allowed factory workers to use racist epithets, failed to take corrective action against harassers and fired black workers who complained.

The suit references an e-mail that CEO Elon Musk allegedly sent to Fremont factory workers addressing complaints of a toxic culture. In this, Musk reportedly told black workers, and other minorities:

"Part of not being a huge jerk is considering how someone might feel who is part of [a] historically less represented group," Musk wrote in the email. "Sometimes these things happen unintentionally, in which case you should apologize. In fairness, if someone is a jerk to you, but sincerely apologizes, it is important to be thick-skinned and accept that apology."

The suit also says that in July this year, black workers at Tesla's Fremont factory sent a note to Tesla's HR business partner Rose Sanson and CEO Elon Musk detailing the kinds of harassment they were experiencing. The email excerpted in the suit said:

"[One worker] spoke up and said he didn't like when associates say N--- on the line. It made him and a lot of us on the line feel uncomfortable. Since that day there has been so much backlash from him getting hit in the back of the head with a chair, to him getting called bipolar, sensitive, people say n---- just to get a reaction out of him.... I just hope whoever reads this does something about it before someone on my line snaps, and someone gets hurt."

Tuesday night, Tesla issued a statement saying the lawsuit was riddled with false claims. In the statement, Tesla revealed that it had investigated employees' reports of racism at the Fremont factory, and had fired three people as a result of its findings.

Tesla also promised:

"There will be further action as necessary, including parting ways with anyone whose behavior prevents Tesla from being a great place to work and making sure we do everything possible to stop bad behavior from happening in the first place. Our company has more than 33,000 employees, with over 10,000 in the Fremont factory alone, so it is not humanly possible to stop all bad conduct, but we will do our best to make it is as close to zero as possible."

Read the full lawsuit filing here: