Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

AUSTIN, Texas — A federal judge declared there is no widespread voter fraud as he took steps to block Texas officials from removing people from voter rolls or making them prove they are U.S. citizens.

U.S. District Judge Fred Biery ruled Wednesday that the state “created this mess” and ordered officials in the 18 counties named as defendants not to remove anyone from the voter registration rolls without his approval.

“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,” the judge said in his order.

He also ordered acting Texas Secretary of State David Whitley to advise officials in the rest of the 254 counties to also not remove anyone from the lists without the court’s approval.

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

The federal judge slammed Whitley and his botched attempt to identify ineligible voters, saying the state officials came up with a solution “inherently paved with flawed results.”

Whitley and his staff burdened “perfectly legal, naturalized Americans” with “ham-handed and threatening correspondence, which did not politely ask for information, but rather exemplifies the power of government to strike fear and anxiety and to intimidate the least powerful among us,” the judge wrote.

Civil rights groups, Latino organizations and lawmakers who had sounded the alarm over Whitley's investigation hailed the judge's decision. In a news release, Whitley's office had announced it had identified 95,000 suspected ineligible voters, some 58,000 of whom had possibly voted illegally.

President Donald Trump had seized on the state’s declaration, using it to renew unsubstantiated claims of voter fraud.

The Texas secretary of state’s office soon had to walk back that declaration as it began to discover that the list contained names of people who were legal residents when they obtained their driver’s licenses but had since become citizens. The state had used drivers’ license records to cross-check voter rolls, but there is no requirement for non-citizens to update their status with the driver’s license office until their license expires.

“This action by the secretary of state was irresponsible,” Thomas Saenz, president of the Mexican American Legal Defense and Educational Fund, which represented some of the defendants, told NBC News on Wednesday. “It was undertaken as a result of the high levels of Latino participation in the 2018 election.”

Whitley is awaiting confirmation of his nomination as secretary of state but Texas media outlets say he may not have enough backing from Democrats to be confirmed.

FOLLOW NBC LATINO ON FACEBOOK, TWITTER AND INSTAGRAM.