A U.S. border patrol agent on the U.S. and Mexico border near Sunland Park, New Mexico.

Congress 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.