A federal judge late Tuesday ordered that officials stop an investigation into political spending by conservative groups in recall elections that took place in Wisconsin in 2012, including that of Gov. Scott Walker.

The judge, Rudolph T. Randa, of the U.S. District Court in the Eastern District of Wisconsin, granted a preliminary injunction to stop the inquiry. In the 26-page order, the judge told prosecutors to return all of the property seized as part of the investigation and to permanently destroy the information they obtained.

A conservative group called the Wisconsin Club for Growth and its director, Eric O’Keefe, had argued that the investigation hurt the group’s ability to participate in elections and to conduct fund-raising.

“The plaintiffs have been shut out of the political process merely by association with conservative politicians,” the judge wrote in the decision. “This cannot square with the First Amendment and what it was meant to protect.”