WASHINGTON — A federal judge on Monday thwarted one of the Trump administration’s key efforts to address rising drug prices by blocking a rule that would have required drugmakers to include the list prices of their medicines in television ads.

Three drug manufacturers — Merck, Eli Lilly and Amgen — sued the administration after the Department of Health and Human Services finalized the rule in May, arguing that the HHS overstepped its authority in requiring pharmaceutical companies to disclose such prices because it did not have permission from Congress to do so.

HHS Secretary Alex Azar, formerly the president for the U.S. division of Eli Lilly, has sought to deliver drug pricing wins that President Donald Trump can tout on the campaign trail.

In May, Azar called the rule “the single most significant step any administration has taken toward a simple commitment: American patients deserve to know the prices of the health care they receive.”

Slated to go into effect Tuesday, the rule would have required drugmakers to include the list price of their medications if they cost $35 or more for a month’s supply, or for the usual course of therapy.

The HHS did not immediately respond to a request for comment.

Judge Amit Mehta of the U.S. District Court for the District of Columbia said the court did not question the HHS’ motives or take a view on whether drugmakers should have to disclose their prices.

“That policy very well could be an effective tool in halting the rising cost of prescription drugs,” Mehta wrote. “But no matter how vexing the problem of spiraling drug costs may be, HHS cannot do more than what Congress has authorized.”

The judge did not rule on the drug companies’ contention that the rule was compelled speech that violated their First Amendment rights.

Drug companies have argued that list prices do not reflect what most patients pay for prescription medicines because they do not account for the discounts negotiated by insurers. And some health care analysts are skeptical that providing the information would have any effect on consumers’ behavior.

But patient advocacy groups have said that Americans should know how much they could pay for medications and that drug companies should be forced to disclose just how much they are charging.

“Drug list prices have been shrouded in secrecy for too long,” AARP Vice President and Chief Advocacy and Engagement Officer Nancy LeaMond said in a statement Monday. “Today’s ruling is a step backward in the battle against skyrocketing drug prices and providing more information to consumers. Americans should be trusted to evaluate drug price information and discuss any concerns with their health care providers.”

Trump made lowering drug prices a central issue of his 2016 presidential campaign and has pressured advisers to deliver talking points ahead of the 2020 campaign, in which he is hoping to make health care and drug costs a top issue. The television ad rule was outlined in a drug pricing blueprint Trump and Azar rolled out last year at the White House to great fanfare.