Texas’s acting secretary of state, David Whitley (R), resigned Monday just months after leading the botched voter purge of nearly 100,000 suspected noncitizens that erroneously also targeted U.S. citizens, efforts that drew rebukes from a federal judge and numerous voter rights groups.

Whitley’s departure came as the Texas Senate failed to confirm him to the position by a two-thirds majority on the last day of the legislative session. He submitted his resignation letter to Texas Gov. Greg Abbott (R) “effective immediately” just before the final gavel, as reported by the Austin American-Statesman. Abbott accepted his resignation shortly afterward, praising his “moral character and integrity.”

Neither Whitley’s resignation letter nor Abbott’s mentioned the controversy.

“Working alongside the employees in the secretary of state’s office, county election officials, and representatives of our #1 trading partner, Mexico, has been my distinct honor and privilege,” Whitley, 36, wrote in the resignation letter, reproduced by multiple local outlets.

Whitley, a gubernatorial appointee and former aide to Abbott, spent less than six months overseeing Texas elections. He will leave office best known for the disastrous elections-integrity operation that wrongly identified thousands of naturalized citizens as suspected noncitizens illegally registered to vote.

He revealed the investigation in January, causing unsupported fears of rampant voter fraud while emboldening Republican politicians who had made similar voter fraud claims — including President Trump. Whitley’s office had claimed that, of 95,000 suspected noncitizens, 58,000 had voted in at least one Texas election over the last 18 years. Letters sent to all those suspected noncitizens threatened to disenfranchise them unless they proved their citizenship within 30 days.

But there was a problem: Nearly a quarter of those identified as possible noncitizens were actually naturalized citizens ― a realization the secretary of state’s office made just four days after its initial announcement.

Numerous voting rights groups sued on behalf of threatened eligible voters, in three separate federal lawsuits, and Congress opened an investigation into the alleged voter suppression efforts. In February, a federal judge blocked Texas from carrying out its “ham-handed” and “threatening” voter purge effort, saying there was no evidence of widespread voter fraud. The letters sent by the secretary of state’s office to thousands of eligible voters threatening to cancel their registration, U.S. District Judge Fred Biery wrote, “exemplifies the power of government to strike fear and anxiety and to intimidate the least powerful among us.”

He placed the blame squarely on Whitley’s shoulders, encouraging him to fix the problems while referencing a kindergarten-friendly lesson.

“The Court further finds and concludes the Secretary of State, though perhaps unintentionally, created this mess,” Biery wrote in his Feb. 27 order. “As Robert Fulghum taught in ‘All I Really Need to Know I Learned in Kindergarten,’ ‘always put things back where we found them and clean up our own messes.’”

Texas agreed to stop its investigation of noncitizen voters as part of a settlement agreement reached with civil rights groups in April.

Democrats and civil rights groups cheered Whitley’s resignation Monday, declaring victory after months of a coordinated effort among at least 10 civil rights groups to oppose his nomination. “David Whitley lost the trust of Texas voters when he attempted to purge thousands of eligible voters,” Workers Defense Action Fund said in a statement. “This is a win for all voters.”

While both chambers of the Texas legislature are controlled by Republicans, there are just enough Democrats in the state Senate to foil a two-thirds majority confirmation vote. None of the 12 Democrats among the 31 total state senators supported Whitley during his confirmation hearing in February.

“The reality is that Democrats showed solidarity on that issue because of Whitley’s position of voter suppression,” state Sen. Royce West (D-Dallas) told reporters Monday, the Texas Tribune reported.

West and the civil rights groups had also expressed concern that the errors Whitley’s office made while investigating ineligible voters had a disproportionate effect on minorities, since naturalized citizens are immigrants. As Biery noted, no native-born citizen was wrongfully threatened with being kicked off the voter rolls; only new Americans were.

Making matters worse, Texas Attorney General Ken Paxton (R) had threatened to prosecute the suspected illegal voters before those on the list were confirmed as illegal voters. “VOTER FRAUD ALERT,” he wrote on Twitter in January. Trump also took note of the issue, tweeting, “These numbers are just the tip of the iceberg. All over the country, especially in California, voter fraud is rampant. Must be stopped.”

Whitley ultimately apologized to lawmakers for the fiasco a week after his confirmation hearing, saying in a letter that the purpose of his “list maintenance process” — his review of the voter rolls for noncitizens — was purely to ensure election integrity. He said he could have done a better job double-checking all voters on the list were in fact noncitizens before making the announcement.

“I recognize this caused some confusion about our intentions, which were at all times aimed at maintaining the accuracy and integrity of the voter rolls,” he wrote. “To the extent my actions missed that mark, I apologize.”

Messages left for the Texas secretary of state’s office and governor’s office late Monday were not immediately returned.

Given the Texas Senate did not confirm Whitley, Abbott will need to appoint a new secretary of state, who will serve in that role awaiting confirmation by lawmakers once the legislature reconvenes in its next session, in 2021.

More from Morning Mix:

‘Large and destructive’ tornado rips through Dayton, Ohio, causing injuries and extensive damage

‘Somebody owes me lunch!’: Prison guards bet on an inmate’s suicide. Then, choking sounds came from her unit.

Amy Klobuchar recalled John McCain’s searing response to Trump’s inauguration. Meghan McCain wasn’t having it.