President Trump issued the first veto of his presidency Friday to secure federal money for a border wall he promised as a candidate and considers a crucial priority for re-election, capping a week of confrontation with both political parties.

“Today I am vetoing this resolution. Congress has the freedom to pass this resolution and I have the duty to veto it,” Trump said in the Oval Office.

Twelve Republicans had joined Democrats to challenge Trump over his declaration of a national emergency at the U.S.-Mexico border, which would allow the president to circumvent Congress and spend billions on wall construction.

The rare rebuke from members of his own party was symbolically important, but Congress does not have the votes to overturn Trump’s veto.

“I’d like to thank all of the Great Republican Senators who bravely voted for Strong Border Security and the WALL,” Trump tweeted ahead of his veto action. “This will help stop Crime, Human Trafficking, and Drugs entering our Country. Watch, when you get back to your State, they will LOVE you more than ever before!”

His re-election campaign also sought to raise money on the issue, sending a message to supporters in Trump’s name that read, “I look forward to VETOING the Dem inspired OPEN BORDERS & Pro-Crime resolution! Donate NOW for the WALL & we’ll TRIPLE MATCH your gift.”

Moments after the Senate voted 59-to-41 to disapprove his emergency declaration on Thursday, Trump gave his one-word response: “VETO!”

Most Republicans who defected did so as a protest vote over the president’s methods and their fear about the precedent of executive overreach rather than the underlying debate over whether a border wall is necessary. Democrats and some Republicans challenged the declaration as a blow to the separation of powers.

Trump had sought to frame the debate in terms of immigration, arguing that Republican senators who supported border security should back him on the emergency declaration.

Trump also has maintained he has the legal authority to act.

A Justice Department letter to congressional leaders details the arguments defending the Trump’s emergency declaration, arguing that the president was authorized to do so by the National Emergencies Act of 1976.

“The president acted well within his discretion in declaring a national emergency concerning the southern border,” the Justice Department argues in the letter, a copy of which was reviewed by The Washington Post.

The letter, which draws much of its reasoning from analysis done by the Justice Department’s Office of Legal Counsel, points to various crises for which past presidents have declared emergencies under the law.

“Many such emergencies dealt with matters less threatening than the ongoing crisis on the southern border. For instance, prior national emergency declarations have authorized the use of statutory powers to prevent the importation of uncut diamonds … and to promote democracy or conflict resolution in various countries around the world. … Presidents have exercised broad discretion in determining what challenges and situations amount to national emergencies.”

The letter, sent last week to the top Democrat and Republican in the Senate, goes on to argue that the situation at the border has worsened.

“The situation at the border has deteriorated, moreover, because the population of migrants crossing the border has shifted from one that consisted primarily of single adults from Mexico, who often could be promptly repatriated, to one that includes large numbers of families and children from Central American countries – people who cannot currently be detained in any significant numbers and who are generally more difficult to remove,” the letter states. “That shift has placed a substantial strain on border-security resources. The President’s emergency Proclamation reasonably described the current situation as an ongoing ‘border security and humanitarian crisis.’ ”

In challenging Trump on Thursday, only one Republican who is up for re-election next year – Susan Collins of Maine – voted for the disapproval resolution.

In addition to Collins, the other Republican senators voting for the resolution were Lamar Alexander of Tennessee, Roy Blunt of Missouri, Mike Lee of Utah, Jerry Moran of Kansas, Lisa Murkowski of Alaska, Rand Paul of Kentucky, Mitt Romney of Utah, Marco Rubio of Florida, Patrick J. Toomey of Pennsylvania, Rob Portman of Ohio and Roger Wicker of Mississippi.

Sen. Thom Tillis, R-N.C., another senator up for re-election in a politically divided state, had announced last month that he would vote for the disapproval resolution. He wrote an opinion piece in The Washington Post at the time arguing there would be “no intellectual honesty” in supporting executive overreach by Trump that he had opposed under President Obama.

But on Thursday, Tillis cast his vote with the president, saying he was reassured by indications that Trump would support changes to the National Emergencies Act itself to rein in presidential powers going forward, and that his Republican colleagues also backed such legislation.

The vote came a day after the Senate called for an end to U.S. military support for the Saudi-led war in Yemen, marking the second instance in two days that a Senate that has been mostly deferential to Trump took a position against him.

Comments are disabled on some stories about sensitive topics.