The U.S. House of Representatives unconstitutionally passed a $1.7 trillion government funding bill in 2022 by allowing lawmakers to vote by proxy instead of in person, a federal appeals court ruled on Friday.

The New Orleans-based 5th U.S. Circuit Court of Appeals voted 9-8 to uphold an injunction secured by outgoing Republican Texas Attorney General Ken Paxton that blocks enforcement of a provision of the measure giving pregnant workers stronger legal protections.

Democrat Nancy Pelosi, who was speaker of the House at the time, helped implement the proxy voting rule in May 2020 after the onset of the COVID-19 pandemic as an emergency measure. The rule was dropped when Republicans took control of the House after the November 2022 elections.

Before Republicans took control, the House used the proxy voting rule to pass a spending package that included the provision Paxton challenged, called the Pregnant Workers Fairness Act. It was signed into law by Democratic President Joe Biden.

The bill passed the House on a 225-201 vote, with 226 members voting by proxy.

Friday's ruling, powered by the 5th Circuit's conservative majority, held that the proxy rule violated the U.S. Constitution's quorum clause, which the court said requires a majority of House members to be physically present to pass legislation.

"While the chambers of the legislature have much discretion regarding their rules of procedure, the Quorum Clause's constraints on congressional power cannot be circumvented by congressional fiat," wrote U.S. Circuit Judge Cory Wilson, an appointee of Republican President Donald Trump.

While the decision concerns how the entire bill was passed, the relief granted to Paxton's office was narrow, barring the U.S. Department of Justice and the Equal Employment Opportunity Commission from enforcing the pregnant workers provision against Texas.

The Justice Department, which defended the law, and Paxton's office did not respond to requests for comment.

U.S. Circuit Judge James Graves, an appointee of Democratic President Barack Obama, called the ruling "illogical, inexplicable, and invalid" in dissent. He said the majority read a physical-presence requirement into the quorum clause that does not exist, and provided no explanation for why, if the entirety of the law was unconstitutionally passed, its ruling should be limited only to one small sliver of the multitrillion-dollar bill.