A federal judge on Wednesday struck down most of President Donald Trump’s first election-related executive order, delivering a major setback to the administration’s effort to reshape federal voting rules.

Obama-appointed U.S. District Judge Denise Casper ruled that the White House lacked the authority to impose many of the changes outlined in the order, including a requirement that voters provide documents proving U.S. citizenship when registering to vote.

The ruling makes permanent an injunction Casper issued last year in a lawsuit brought by Democrat attorneys general from 19 states. She found that the Constitution gives states and Congress, not the president, the primary authority over elections.

She concluded that the executive branch cannot unilaterally rewrite election procedures established by law.

“While the Constitution vests the President with ‘executive Power’ and commands him to ‘take Care that the Laws be faithfully executed,’ it does not grant the President any specific powers over elections,” Casper wrote.

“As a result, the President ‘plays no direct role in the process of appointing electors, ‘nor does he have authority to control the state officials who do,’” she added.

Trump’s order sought to impose several new election requirements. Along with a proof-of-citizenship mandate, it would have blocked states from counting mailed ballots received after Election Day, even if they were postmarked on time. The order also threatened to cut off certain federal funds to states that refused to comply.

The ruling is the latest court defeat for Trump’s election order, which has faced multiple legal challenges since it was signed early in his second term. A separate election directive Trump signed in March, aimed at creating a nationwide voter database and tightening mail voting rules, is also being challenged in court.

While the administration has faced repeated setbacks in court, Trump has continued pressing Congress to enact a citizenship-verification requirement through legislation. The Republican-backed SAVE America Act cleared the House but has stalled in the Senate.

Trump renewed that push Wednesday, saying he would withhold his signature from a bipartisan housing measure until lawmakers approve voter citizenship verification requirements.