A federal judge on Friday barred the Trump administration until further notice from setting up a $1.8 billion fund to compensate people claiming to have been unfairly prosecuted by the government, saying that her order was needed because of mixed messages about the scheme from President Trump.

The ruling by the judge, Leonie M. Brinkema, was the strongest effort to date by anyone in government to hold the administration to its word that the proposal to create the fund had actually been set aside. While Todd Blanche, the acting attorney general, told Congress last week that the fund would not move forward, Mr. Trump has been much more circumspect, insisting that he still loves the idea and believes that people who suffered in court at the hands of the government should get financial compensation.

Judge Brinkema seized on the president’s statements during a hearing in Federal District Court in Alexandria, Va., suggesting they left open the possibility that the fund could be brought back to life despite Mr. Blanche’s promises and assertions made in court papers that the fund was no longer moving forward.

“We just don’t have the absolute certainty that this fund won’t rear its head in another form,” she said.

Judge Brinkema did, however, give the administration a way out. She said she would consider rescinding her order if, within a week, the Justice Department sent her a declaration, filed under penalty of perjury, that the fund was dead once and for all. She told Andrew Block, a department lawyer who appeared in court for the government, that the declaration needed to be signed by Mr. Blanche and Scott Bessent, the Treasury secretary.

Judge Brinkema’s ruling extended a temporary pause on the fund that she had put in place at the end of May. And it came two days after a federal judge in Washington, Richard J. Leon, refused to issue his own order putting the fund on hold.

Judge Leon took the Justice Department at its word that the plan had been shelved, but still warned the administration not to play games with him by pretending it was dead, if it was not.

“Don’t play possum with this court,” he said.

The fund has created a political headache for the White House almost from the moment it was first announced on May 18 — in no small measure because of concerns that it could be used to funnel taxpayer money to hundreds of rioters prosecuted for storming the Capitol on Jan. 6, 2021.

Judge Brinkema underscored those concerns by reading aloud a passage about payments being made to the rioters that appeared in a brief criticizing the fund that was submitted to her last week by two senators, Cory Booker, Democrat of New Jersey, and Bill Cassidy, Republican of Louisiana.

“A scheme deliberately designed to recast insurrectionists — including those who perpetrated violence against law enforcement officers — as victims and legitimate prosecutions as persecution does not merely rewrite history,” the judge read from the bench. “It creates incentives for similar conduct in the future, with the explicit encouragement of the officials responsible for administering justice.”

The lawyers who challenged the administration in front of Judge Brinkema celebrated her order, saying it would keep the fund in check, despite “the administration’s shifting explanations” about its future.

“The court recognized the serious legal concerns raised by the Trump-Vance administration’s attempt to create a secretive, taxpayer-funded compensation program operating outside the constitutional safeguards that govern public spending,” said Skye Perryman, the president and chief executive of Democracy Forward.

The nonprofit group brought the case on behalf of five clients — among them, a former federal prosecutor fired after working on Jan. 6-related cases — who asserted they had been wronged by the Trump administration and would be prevented from filing claims with the fund because it was designed to compensate people alleging harm by Democratic administrations.

The fund emerged from an extraordinarily unusual ploy to settle a $10 billion lawsuit that Mr. Trump had filed against the I.R.S., a federal agency that he technically controls. The suit accused the I.R.S. of not doing enough to stop a contractor from leaking his tax information to The New York Times in 2019.

As part of the same deal, the I.R.S. and the Justice Department gave the president an even more remarkable and personal benefit, granting him, his family and businesses broad protections from tax investigations.

Judge Brinkema made clear on Friday that her order applied only to the compensation fund, not to the tax provision. She noted that the entire settlement deal — including both the fund and the I.R.S. protections — was being scrutinized as a potential act of fraud by the federal judge in Miami, Kathleen M. Williams, who oversaw the original lawsuit.

Shortly after being assigned the I.R.S. suit, Judge Williams, an Obama appointee, had questioned whether it presented an actual conflict that she could consider, given that Mr. Trump was effectively on both sides of the matter. When she closed the case, she noted there was no “settlement of record,” but shortly after, the Justice Department released its agreement dismissing the suit.

Judge Williams effectively reopened the case last month after 35 former federal judges urged her to examine whether Mr. Trump’s legal team and the Justice Department had colluded to reach the deal in a way that avoided any scrutiny or oversight.

As part of her inquiry, Judge Williams asked Mr. Trump’s personal lawyers to tell her in writing whether the dismissal of the suit was “premised on deception” and whether it should be formally reopened because she was the “victim of a fraud.” On Friday night, the lawyers filed court papers to her asserting that they had engaged in neither fraud nor deception, adding that the judge herself had made the decision to close the case without having seen the agreement that ultimately surfaced.

The lawyers also echoed comments that Mr. Blanche had made, suggesting that the deal to end the suit was a routine settlement between a plaintiff and the government — even though that plaintiff happened to be the president.

“A district court has no roving authority to review or approve a settlement between private parties and the government in ordinary litigation,” they wrote.

It remains unclear what steps Judge Williams might now take to delve further into the details of the arrangement.

Aishvarya Kavi contributed reporting from Washington.