WASHINGTON—The Trump administration and its Republican allies on Capitol Hill took aim Thursday at the growing practice of federal judges issuing nationwide rulings, hoping to tackle an issue that has repeatedly stymied President Trump’s agenda during his year-and-a-half in office.

The Department of Justice issued new guidance to government attorneys, saying they should argue vigorously in court against “nationwide injunctions,” when a federal judge on one of the U.S.’s 94 district courts issues a ruling that covers the entire country, often halting a presidential initiative, program or action.

The House Judiciary Committee, meanwhile, approved legislation to curb nationwide injunctions. The bill, proposed by panel Chairman Bob Goodlatte (R., Va.), would instruct judges to write rulings that apply only to the individuals, organizations or entities that are part of the lawsuit in front of them.

While the federal judiciary operates as an independent branch of government, Congress retains significant authority under the Constitution to write rules governing federal courts, including questions of procedure, organization and jurisdiction. It is unclear how the courts would view legislation like that of Mr. Goodlatte, which limits the kinds of rulings they can issue and the scope of how they decide cases.

Although the legislation’s path to enactment is far from clear, the proposal from the top Republican on the Judiciary Committee reflects a frustration among some conservatives and the administration about the workings of the court system.

Newsletter Sign-up Politics Alert Major political news, from campaigns to the Capitol. PREVIEW

Mr. Trump has seen a number of setbacks in federal court on his signature policies, from his travel ban to his decision to end a program protecting young undocumented immigrants from deportation.

Republicans did note that the practice began in its present widespread form under Democratic President Barack Obama, and that conservatives benefited from it then.

During the Judiciary Committee’s debate on the bill, Democrats argued that judicial injunctions play an important role protecting civil liberties.

“Nationwide injunctions are certainly not appropriate in all circumstances; there are good reasons, of course, to act cautiously before issuing such a broad remedy,” said Rep. Jerrold Nadler (D., N.Y.). “But we should not completely dismantle this important tool and risk depriving Americans of the protections they deserve.”

Republicans responded that even under their legislation, class-action lawsuits could still trigger nationwide injunctions. Democrats said such lawsuits often take too long for urgent constitutional questions.

In his new guidance Thursday, Attorney General Jeff Sessions urged Justice Department lawyers to argue in court that nationwide injunctions exceed constitutional limits on judicial power and are “not consistent with centuries of historical judicial practice.”

“This trend must stop,” Mr. Sessions said in a speech on violent crime in Kansas City, Mo. “We have a government to run.”

To issue an injunction against a policy, a judge must find that its challengers are likely to prevail in court and that irreparable harm would result from continuing the policy meanwhile. When judges have applied the injunctions nationwide, they have done so after having found that serious harm would ensue unless the policy was halted across the U.S.

Judges ordered injunctions on several versions of Mr. Trump’s travel ban on citizens from certain Muslim-majority nations; his attempts to punish municipalities for protecting illegal immigrants; and his order banning transgender service members. In all, Mr. Trump’s policies have been the subject of nearly two dozen national injunctions since he took office in 2017.

The Supreme Court has never ruled on the practice of such injunctions, though Justice Clarence Thomas has expressed his displeasure in a recent opinion that upheld Mr. Trump’s travel ban.

“These injunctions didn’t emerge until a century-and-a-half after the founding,” Justice Thomas wrote. “And they appear to be inconsistent with longstanding limits on equitable relief and the power of Article III courts. If their popularity continues, this Court must address their legality.”

Critics say it is that increase in frequency that necessitates congressional action.

“Judicial overreach in the form of national injunctions has increasingly frustrated administrations of both parties,” Mr. Goodlatte said. “Although the Trump administration has been the target of over 22 national injunctions to date, the practice took off in 2015 as a means of stopping major Obama administration policies.”

Mr. Trump’s critics say the courts are acting more frequently during his tenure because he pushes the legal envelope more often with far-reaching policies.

While liberals have cheered judicial action to halt Trump policies, under Mr. Obama, conservatives cheered when rulings went against White House policies. The Obama administration experienced legal setbacks when judges halted enforcement of environmental rules on power generation and immigration rules pertaining to the parents of young illegal immigrants, as well as declared parts of his signature health-care law unconstitutional.

In many of those cases, it was progressive Democrats who decried the actions of a single judge—often sitting in a court in a conservative state—to halt the president’s policies.

Ilya Somin, a law professor at George Mason University, warned that Republicans might come to regret legislation against nationwide injunctions, since they could hamper the ability of conservative litigants to challenge a future liberal presidency.

“This is a tool that they might like to have the next time there’s a Democratic administration,” Mr. Somin said.

—Sadie Gurman contributed to this article.

Write to Byron Tau at byron.tau@wsj.com