A U.S. border patrol agent on the U.S. and Mexico border near Sunland Park, New Mexico.Charles Ommanney | Getty ImagesCongress fell short Thursday in its second attempt to end the national emergency President Donald Trump declared to secure money for his proposed border wall.Both chambers of Congress have passed measures to block Trump’s declaration twice since the president took the step in March, prompting two vetoes. Lawmakers failed to override the second veto Thursday as the GOP-held Senate could not muster the two-thirds majority needed.The chamber voted by a 53-36 margin to end the emergency. Ten Republicans voted with Democrats in supporting the resolution.Democrats and some Republicans have accused the president of overreaching and disregarding Congress’ power of the purse by declaring the national emergency. A federal judge ruled Friday that Trump violated the law by using the declaration to divert money to wall construction — though the ruling will not affect a major chunk of the funds he hopes to use for the barrier.Trump had hoped for $5.7 billion to build the wall, but Congress only appropriated $1.375 billion. The declaration allowed him to divert $3.6 billion to his proposal from the military construction budget, along with money from other administration sources.Democrats have accused Trump of raiding money from Department of Defense projects to follow through on a 2016 campaign goal. The Republicans who voted to end the emergency worried about the precedent supporting the emergency would set if presidents try to take similar steps in the future.Democrats had tried to pressure Senate Republicans up for reelection next year in states from which the administration will pull money to join them in blocking Trump’s move. Senators in that group such as Cory Gardner of Colorado, Martha McSally of Arizona, Thom Tillis of North Carolina and John Cornyn of Texas have repeatedly voted with Trump on the issue.Sen. Susan Collins, R-Maine, has consistently voted with Democrats to block the declaration.Subscribe to CNBC on YouTube.