WASHINGTON — The Senate voted 59-41 on Thursday to overturn President Donald Trump’s national emergency declaration, citing in part concerns with plans to divert billions of dollars from the Pentagon budget to build a southern border wall — a plan critics say would harm military readiness.

Twelve Republicans joined every Democrat to pass the resolution — a vote which may trigger the first veto of Trump’s presidency. Trump has framed the issue as a matter of national security, and has already deployed thousands of active-duty troops to southern states to assist with border security missions and wall construction.

But critics of the plan call it an inappropriate use of military funding, one that will take away about $3.6 billion in construction funds from unnamed base projects. They also say Trump’s use of emergency powers to redirect money Congress already appropriated violates the spirit of the Constitution.

Earlier in the day, an infuriated Sen. Tim Kaine, D-Va., accused acting Defense Secretary Patrick Shanahan of withholding a list of military construction projects that could be hurt by the funding shift until after Thursday’s heated vote.

The service secretaries have had the lists but said they needed Shahahan’s OK to share them with lawmakers. Shanahan told members of the Senate Armed Services Committee he would make those available sometime after the vote and that there is no “deliberate attempt to withhold any information” from Congress.

Kaine disagreed.

“I feel completely sandbagged,” he said in an angry exchange with the top Pentagon leader. “Members of the Senate are entitled to know from where these (military construction) monies will be pulled.”

The question of which military construction projects will be delayed or canceled by the funding moves has lingered since the president’s emergency declaration a month ago. White House officials promised critical construction projects related to force readiness and lethality will not be hurt, but they’ve given few hints as to which states and bases may lose out on anticipated funding.

Two weeks ago, the House voted 245-182 to cancel Trump’s emergency declaration, with 13 Republicans crossing the aisle to deliver a rebuke to the White House.

In recent days, Senate Republican lawmakers worked in vain to sway Trump to compromise on the wall-funding issue.

Just before the vote, Sen. Rob Portman, R-Ohio, said he believes the immigration situation on the U.S.-Mexico border is a national security crisis, but the emergency declaration to access funds sets a dangerous precedent that usurps Congress’ constitutional power of the purse.

“Each one of us in this body has sworn an oath to support and defend the Constitution of the United States,” he said before casting his vote against the president.

Other Republicans said the security situation outweighs those worries. Senate Majority Leader Mitch McConnell, R-Ky., urged colleagues preoccupied with constitutional concerns surrounding the vote to focus instead on the humanitarian and security crisis on America’s southern border.

“The president is operating within existing law, and the crisis on our border is all too real,” he said.

But Senate Minority Leader Chuck Schumer, D-N.Y., argued the president declared an emergency only to get around Congress, and he pleaded with undecided Republican colleagues to put a check on presidential overreach.

“If a president can invoke an emergency because he didn't get his way or she didn't get her way without real cause, without a real emergency, woe is our republic in many ways,” he said.

“This is a moment that changes our country’s fundamental balance of power.”

Thursday’s vote marked the second time the Republican-controlled Senate has defied Trump on a national security issue in the last in two days. On Wednesday, members narrowly voted to end U.S. military involvement in Yemen’s civil war, over Trump’s objections.

The legislation to overturn the national emergency declaration now heads to Trump’s desk, where he has already promised to veto it.

“The current situation at the southern border presents a humanitarian and security crisis that threatens core national security interests and constitutes a national emergency,” administration officials wrote in their veto recommendation earlier this week.

“The southern border is a major entry point for criminals, gang members, and illicit narcotics. The problem of large-scale unlawful migration through the southern border is enduring, and, despite the administration’s use of existing statutory authorities, in recent years the situation has worsened in certain respects.”

The vote margin in the Senate was large enough to override a potential presidential veto, but the House margin was not. The White House also faces numerous court challenges on the emergency declaration and funding shifts before any work moves forward.