The Senate passed a resolution to terminate President Donald Trump's national emergency declaration to build his border wall.

The resolution received unanimous Democratic support, with several Republicans crossing the aisle.

The resolution, which the House passed in February, will now head to Trump's desk, where he's already promised to veto it.

As it stands, there are not enough votes in the House and Senate to override a presidential veto.

WASHINGTON — The Senate voted on Thursday to terminate President Donald Trump's national emergency declaration to divert military funds for the purpose of building additional mileage of physical barriers along the United States border with Mexico.

The vote, during which 12 Republicans crossed the aisle to pass the resolution, 59-41, will head to the president's desk, setting up the first major veto of Trump's presidency.

Read more: The lawsuits challenging Trump's national emergency declaration to build the border wall keep piling up

Proponents of the resolution, which passed the House, 245-182, in February, were unable to muster enough support for a veto-proof majority. The House would need 290 votes and the Senate would need 67 to stop the emergency declaration. The White House has already pledged to veto the resolution in a statement of administration policy.

In advance of the Senate vote, Vice President Mike Pence tried to curtail an embarrassing rebuke of Trump. Pence angled for a compromise that in exchange for GOP defectors stomaching support for the emergency declaration, Trump would sign a bill into law to curtail future abuses of emergency powers.

But when Sen. Mike Lee of Utah put forth a bill to do just that, Trump informed him and Senate Republicans during their Wednesday lunch he would not get on board the measure, according to a GOP aide. In addition, House Democrats were not entertaining such a plan. This effectively killed any chance of keeping the entire Senate Republican Conference in line.

On Thursday, Trump attempted to win over GOP senators by reversing course hours before the vote.

"If, at a later date, Congress wants to update the law, I will support those efforts, but today’s issue is BORDER SECURITY and Crime!!! Don’t vote with Pelosi!" he wrote on Twitter.

A handful of Republicans came forward to back the resolution for constitutional reasons. Sen. Rand Paul of Kentucky cited his disdain for executive overreach and squaring it with their past opposition to former President Barack Obama.

"Every single Republican I know decried President Obama's use of executive power to legislate. We were right then," Paul wrote in an op-ed announcing his support for the resolution. "But the only way to be an honest officeholder is to stand up for the same principles no matter who is in power."

Every Senate Democrat voted in favor of the resolution. In addition to Paul and Lee, several other Republicans came out to back the resolution, including Sens. Mitt Romney of Utah, Lamar Alexander of Tennessee, Lisa Murkowski of Alaska, Pat Toomey of Pennsylvania, Susan Collins of Maine, Rob Portman of Ohio, Marco Rubio of Florida, Roger Wicker of Mississippi, Roy Blunt of Missouri, and Jerry Moran of Kansas.

Initially, Republican Sen. Thom Tillis of North Carolina pledged to vote in support of a resolution terminating the emergency declaration. But Tillis, faced with the prospect of a primary challenge and tough reelection bid in 2020, reversed his position minutes before the vote.

Romney said in a statement before the vote that while he agrees a physical barrier is "urgently needed to help ease the humanitarian crisis at the southern border," he could not square Trump's use of emergency powers with his constitutional oath.

"We experienced a similar erosion of congressional authority with President Obama's unilateral immigration orders — which I strenuously opposed," he said. "In the case before us now, where Congress has enacted specific policy, to consent to an emergency declaration would be both inconsistent with my beliefs and contrary to my oath to defend the constitution."

Shortly after the vote concluded, Trump posted a one-word tweet reiterating his stance, writing, "VETO!"