Just before taking 2020 debate stage, Montana Gov. Bullock handed victory in dark money case The victory was announced just ahead of the debate,

Moments before Montana Gov. Steve Bullock joined other 2020 candidates on the Democratic debate on Tuesday, his team delivered news about a victory back home: the governor just won a year-long lawsuit against the Trump administration.

Bullock, whose campaign message centers on removing dark money from politics, sued the Internal Revenue Service a year ago over a rule requiring that politically-active nonprofit groups disclose to the IRS names of donors. The rule had been overturned by President Donald Trump's administration.

A federal judge in Montana, Brian Morris, ruled on Tuesday evening that the rule would be reinstated.

According to the docket, which was provided to ABC News by the Bullock campaign, the court “holds unlawful" the rule as adopted by the IRS and said the agency “must follow the proper notice-and-comment procedures pursuant to the APA it if seeks to adopt a similar rule.”

Under the previous law, the names of donors who gave $5,000 or more in their tax returns would be disclosed to the IRS, although the IRS would redact those names when making those documents public. Such groups are commonly called “dark money” groups because they don't disclose their donors publicly unlike other politically active groups that disclose their donors to the FEC such as super PACs.

In an interview about the lawsuit with ABC News in June, Bullock said that if elected officials behaved "like NASCAR, sponsored by different companies, at least voters oughta know who's doing the buying.”

“Literally now, a Russian could give to the NRA, and not even the IRS would know,” he said at the time.

Bullock, who did not qualify for the first Democratic debate in June, makes his debut Tuesday night at the second Democratic debate in Detroit.

A spokesperson for the IRS did not immediately respond to a request for comment.