Shortly before the Senate's closing gavel ended his term as Texas secretary of state, David Whitley delivered his letter of resignation, "effective immediately," to Gov. Greg Abbott on Monday afternoon.

Whitley needed Senate confirmation by the end of the legislative session to remain on the job but fell short of the required 21 votes despite expected support from all 19 Republican senators.

All 12 Democrats, however, held firm in their opposition to Whitley over his handling of an error-filled investigation into the citizenship status of registered voters that prompted three federal lawsuits and an eventual court settlement that halted the probe and limited the scope of future investigations.

Abbott, Whitley's friend and mentor, was unable to dislodge opposition to the nominee in the 3½ months since Whitley's confirmation hearing before the Senate Nominations Committee.

In his resignation letter, Whitley thanked Abbott, who nominated him to the job in December, for the opportunity but mentioned nothing about the citizenship investigation or his troubles in the Senate.

"To have your trust," Whitley wrote, "goes beyond what I ever dreamed of as a kid growing up in a small South Texas community."

Abbott quickly accepted the resignation, praising the "moral character and integrity" of Whitley, his former deputy chief of staff in the governor's office. Whitley had begun working for Abbott in 2004 and spent almost four years as the then-attorney general’s travel aide, driving Abbott across Texas and helping him move from automobile to wheelchair.

For Democrats, Whitley committed two unforgivable transgressions.

First, there was Whitley's Jan. 25 announcement than an investigation by his office had identified almost 100,000 potential noncitizens who had registered to vote, including 58,000 who had cast at least one ballot since 1996. President Donald Trump and other leading Republicans publicized the announcement as proof of widespread election fraud.

Second, Whitley referred the list of names to Texas Attorney General Ken Paxton for possible prosecution of election law violations.

It soon became apparent, however, that many of the suspect registered voters were naturalized U.S. citizens who were eligible to vote, and Whitley later acknowledged that his office was aware that naturalized citizens could have been included in the list.

Democrats and civil rights leaders accused Whitley of trying to intimidate naturalized voters or purge them from the voting rolls.

Sen. José Rodríguez, chairman of the Senate Democratic Caucus, said Monday that Whitley's nomination had been undermined by fear and anxiety created by his "attempted voter purge."

"The damage done by his actions requires a clear message to the voters of Texas: All eligible voters should be assisted by the state’s highest election officer in exercising their right to vote, not targeted for suppression by the state’s leadership," said Rodríguez, D-El Paso.

Gilberto Hinojosa, chairman of the Texas Democratic Party, thanked Senate Democrats for remaining firm in their opposition to Whitley, "keeping a watchful eye on Republicans who sought to scare, confuse and intimidate Texans from participating in their democracy."

Shortly after it was announced, the secretary of state's citizenship investigation was met with three federal lawsuits from civil rights groups and naturalized voters.

Faced with evidence of flaws in the list of potential noncitizen voters, U.S. District Judge Fred Biery issued an order in late February blocking Texas counties from sending letters to those identified as potential noncitizen voters that demanded proof of citizenship within 30 days.

About two months later, the lawsuits were settled out of court.

Under the settlement agreement, Whitley rescinded his Jan. 25 advisory on potential voting irregularities, adopted a limited process to investigate the citizenship of voters in the future and agreed to pay $450,000 to the plaintiffs to cover legal costs and fees.