SolarCity improperly fired three employees who blew the whistle about alleged sales practices that were used to justify an "unreasonably high valuation" of the solar energy services company, a new lawsuit charges.

The San Mateo, California-based maker of solar panels also discriminated against the employees, by failing to address sexual harassment that targeted one, and by terminating an older worker and hiring a younger replacement, the lawsuit alleges.

Filed on July 25 in San Diego Superior Court, the court complaint also targets Tesla, the electric car company that acquired SolarCity as a subsidiary in Nov. 2016. Tesla's CEO is Elon Musk, the billionaire tech entrepreneur who has led breakthroughs in electrical and solar energy, along with space technology.

The lawsuit seeks unspecified financial damages and other relief.

The civil action was filed days before Tesla's scheduled Aug. 1 report of the company's second-quarter earnings.

Tesla said the jobs of the three ex-employees were eliminated when the company acquired SolarCity and closed its door-to-door sales for energy products. "The suggestion that they were eliminated for any other reason is false," the company said.

Jean-Paul Le Clercq, the Makerem & Associates attorney who filed the lawsuit, did not respond to email and voicemail messages.

Le Clercq filed the lawsuit on behalf of Andrew Staples, Robert Ray, and Anqunetta White, all of whom had acted as sales representatives for SolarCity's solar panel products. They were part of the same work team whose members were laid off in late May 2017 "for a pretextual reason," the lawsuit alleges.

The now ex-employees complained that other, unnamed workers created "fake potential sales accounts" that were used to support unjustified bonuses and also were "disseminated to investors and shareholders to justify an unreasonably high valuation of SolarCity," the lawsuit charges.

Additionally, the former employees complained that other workers signed contracts on behalf of SolarCity and Tesla "for their own personal gain," the lawsuit alleges.

The three reported the information to many numerous managers, the lawsuit charges. The court complaint says the employees brought their complaint about the alleged fraud to the "Defendants' CEO," but it did not identify Musk by name.

"Rather than address and/or remedy any of the illegal conduct, defendants retaliated against plaintiffs by ... terminating them for a false reason on or about May 31, 2017," the court complaint alleges.

Tesla said the allegation about false sales records "was investigated and found to be inaccurate. We confirmed there was in fact a valid contract signed by the customer."

More Money:Tesla's limited-edition surfboard sells out in just one day

More:McDonald's unveils MacCoin to celebrate Big Mac's 50th anniversary

More Money:Twitter elevates executives in restructuring aimed at more engaging content

Separately, Staples, whom the lawsuit identified as a gay man, charged that he was "continually harassed due to his sexual orientation" by a supervising employee from another SolarCity department. The lawsuit alleges that Staples complained to numerous managers, including Musk, but nothing was done to discipline the harasser.

Tesla said Staples "never complained that his supervisor engaged in sexual orientation harassment of any kind."

Ray had a "strong work performance" and was not disciplined for any performance issues while working for SolarCity, the court complaint says. When he was terminated, Ray, who was 59 at the time, allegedly was told his position was being eliminated.

However, Ray learned "he was subsequently replaced by a significantly younger individual that was less than 30 years old," the lawsuit alleges.

The three former SolarCity employee who filed the lawsuit also charged that they often worked more than eight hours per day 40 hours per week, yet did not receive required overtime pay. Solar City also failed to provide required meal and rest breaks, the lawsuit charges.

Tesla said a complaint from White that said she was not allowed to record overtime properly "was unsubstantiated."

"Tesla is absolutely against any form of discrimination, harassment, or unfair treatment of any kind by or against anyone, and we take any concerns raised by employees very seriously, as we did here," the company said. In this case, the facts simply don't support the plaintiffs' story."

Anticipating Tesla's latest earnings statement, UBS analyst Colin Langan warned in a research note issued Sunday that Tesla could backfire in the next 12 months, with the stock dropping by more than 30 percent. Langan based the forecast on the electric-car maker's inability to turn a profit in 2019 and its need to raise additional capital.

He also predicted that Tesla's second-quarter earnings report, scheduled after Wednesday's close of financial markets, would be weaker than Wall Street anticipates.

Follow USA TODAY reporter Kevin McCoy on Twitter: @kmccoynyc