LOS ANGELES — The #MeToo movement continued to convulse California’s halls of power on Thursday as Tony Mendoza, a powerful Democratic state senator, resigned from the Legislature after an investigation into allegations that he had made improper advances toward several women.

Mr. Mendoza, 46, a former elementary school teacher from Los Angeles, was the third California lawmaker to resign amid the national conversation about sexual harassment, which has toppled powerful figures in Hollywood, politics, the news media and other industries.

His resignation came just as fellow lawmakers were preparing to vote on whether to expel him from the State Senate or suspend him without pay. He had been on leave since January.

Mr. Mendoza has denied the allegations and apologized to anyone who had ever felt uncomfortable in interactions with him. He left office on Thursday with an incendiary resignation letter that blasted his colleagues and questioned the legitimacy of the three-month investigation into his conduct, saying he was not given “any opportunity to defend myself.”