For the first time in 59 years, a U.S. president has vetoed the National Defense Authorization Act.

President Donald Trump late Wednesday refused to sign the $740 billion legislation that funds the U.S. Armed Forces. He is angry at Senate Republicans for refusing to repeal a section of the communications code protecting Twitter, Facebook and other tech giants from content liability.

Trump has said social media companies are biased against him. He also earlier threatened to veto the legislation over a provision requiring the renaming of military bases honoring Confederate leaders.

"Unfortunately, the act fails to include critical national security measures, includes provisions that fail to respect our veterans and our military's history and contradicts efforts by my administration to put America first in our national security and foreign policy actions," Trump said in a statement to Congress.

"It is a 'gift' to China and Russia," he claimed.

"The United States of America trained and deployed our heroes on these hallowed grounds, and won two World Wars. Therefore, my administration will not even consider the renaming of these magnificent and fabled military installations," Trump said.

Congress has a veto-proof majority to overturn Trump. The Senate approved the law by a vote of 84-13 two weeks ago - which is more than the 67-vote margin needed to override a presidential veto. The bill passed in the House earlier by a vote of 335 to 78.

Congress will meet next week to override Trump's veto. The House will return from the holiday break Monday while the Senate will vote Tuesday.

Both the House and the Senate have more than enough votes to override Trump's veto and their leaders have said they would do so. Senate majority Leader Mitch McConnell (D-KY) said the Senate will vote on overriding the veto Tuesday.

Sen. Jim Inhofe (R-OK), chairperson of the Senate Armed Services Committee said the legislation must become law and that Trump's veto is a threat to national security.

"The NDAA has become law every year for 59 years straight because it's absolutely vital to our national security and our troops," tweeted Inhofe.

"This year must not be an exception. Our men and women who volunteer to wear the uniform shouldn't be denied what they need - ever."

Inhofe said the legislation "cements all the remarkable gains our military has made thanks to Donald Trump's leadership. I hope all of my colleagues in Congress will join me in making sure our troops have the resources and equipment they need to defend this nation."

Sen. Mark Warner (D-VA), vice chairperson of the Senate Select Committee on Intelligence, said Trump's veto "poses a serious threat to U.S. national security."

House Speaker Nancy Pelosi (D-CA) said Trump continued to create confusion. "Disturbingly, Trump is using his final hours in office to sow chaos, including by denying our service members a long-overdue pay raise and hazard duty pay; our families paid family leave, child care, housing and health protections; and our veterans the benefits that they need and deserve," she said.

"Donald Trump just vetoed a pay raise for our troops so he can defend dead Confederate traitors," tweeted Senate minority leader Sen. Chuck Schumer (D-NY) in emphasizing one of Trump's demands.

"Democrats will vote to override it," promised Schumer.

Sen. Jeanne Shaheen (D-NH), a senior member of the Senate Armed Services Committee, said the legislation wasn't about politics but "the security of the United States and the safety of our men and women in uniform."

"The Kremlin is actively attacking our cyber networks," said Shaneen. "Instead of standing up for our national security, the president is downplaying Russia's involvement - which contradicts U.S. intelligence - and now he just vetoed legislation that contains actionable items that we can use to hold Putin accountable for this kind of belligerent behavior."

Sen. Richard Blumenthal (D-CN), a member of the Senate Armed Services Committee, said he was speechless after Trump's decision not to sign the NDAA.

"Literally right after what could be the most massive cyberattack in our nation's history, the president is eliminating the new tools and authorities we need for our nation's cyber defense," Blumenthal said.