A federal judge Monday ordered the U.S. Agency for International Development to undo the January suspension of one of its largest nonprofit contractors, saying the agency’s attempt to sanction the widely criticized contractor violated the law.

USAID barred International Relief and Development, headquartered in Arlington, Va., from future federal work, alleging “serious misconduct” in IRD’s performance and management of taxpayer money, including reportedly millions of dollars in excess overhead costs.

IRD filed suit in June, however, and weeks later USAID announced in response that it was lifting IRD’s suspension. USAID acknowledged that in possible violation of federal law, its contract suspension officer also headed its acquisition office, a potential conflict of interest, and that USAID would conduct a new review of IRD after a re-organization.

U.S. District Judge Royce C. Lamberth Jr. of the District on Monday said USAID’s June 24 about-face was not enough, ordering USAID to direct contract officers to fairly consider IRD proposals for new awards, inform other government agencies that its suspension was illegal and correct misstatements made to all other parties.

“Defendants are enjoined from making contracting decisions regarding plaintiffs that rely on plaintiffs’ now-voided suspension,” Lamberth wrote in granting IRD a preliminary injunction, concluding that the firm was likely to prove its claim that USAID violated the Administrative Procedures Act.

In a statement, new IRD chief executive Roger Ervin said, “the Court has made it very clear that the suspension of IRD should have never happened. . . . With this important ruling, we are hopeful that the remaining issues can be resolved quickly and litigation ended.”

“We will comply with the court order,” USAID spokesman Ben Edwards said by e-mail, declining further comment.

Since 2007, USAID awarded more than $2.4 billion to IRD, much of it to rebuild war-wrecked cities, towns and roads and other stabilization projects in Iraq and Afghanistan, several of which have been investigated for allegations of waste and fraud.

IRD also has been criticized for providing lavish salaries and millions in bonuses, gifts and expensive retreats for its employees, including family members of its founder, Arthur B. Keys, an ordained minister, and his wife, Jasna Basaric-Keys. Many of the allegations were included in a May 2014 report and subsequent reports by The Washington Post.

Ervin has forced seven of IRD’s longtime officers to resign and removed its board members since taking over in December. The nonprofit organization’s annual revenue from USAID dropped from $587 million in 2010 to $78 million last year.

Ervin has tried to turn around the firm, and said that IRD was cooperating with investigators with the inspectors general for USAID and the State Department and the Special Inspector General for Afghanistan Reconstruction.

“The impact of this suspension was dire and did not serve the interests of the government, taxpayers or beneficiaries,” IRD spokesman Dan DuPont said, saying it cost the firm 340 employees and tens of millions of dollars, and disrupted services to millions of war-zone beneficiaries, including refugees and displaced persons.