US President Barack Obama has vetoed a $612 billion defense spending bill, saying message to the Republican-controlled Congress is “let's do this right.”

After vetoing the National Defense Authorization Act (NDAA) on Thursday, just two days after Congress sent it to his desk, Obama said that the text agreed by Congress "falls woefully short" in key areas, AFP reported.

“I’m going to be vetoing this authorization bill. I’m going to be sending it back to Congress, and my message to them is very simple: Let’s do this right,” Obama said.

He said the bill resorted to budget "gimmicks," and wastes money on unnecessary programs and prevents the closure of Guantanamo Bay military prison.

"This legislation specifically impedes our ability to close Guantanamo," he said. "Guantanamo is one of the premier mechanisms for [terrorists] to recruit, it is time for us to close it. It's outdated, it's expensive."

Obama also said the budget "prevents a wide range of reforms that are necessary for us to get our military modernized."

"We have repeatedly put forward a series of reforms eliminating reforms that the Pentagon does not want, Congress keeps stuffing 'em back in," he said.

"We end up wasting money, we end up diverting resources from things that we do need," the president stated.

Obama also held a photo op in the Oval Office when he rejected the National Defense Authorization Act, a public rebuke of Republicans, who had warned the president not to veto it.

Obama had reportedly threatened to reject the bill because it allocates $38 billion into a war fund not subject to budget caps, arguing that it skirts spending caps put in place by the 2011 Budget Control Act.

“The bill includes this slush fund tactic that’s an irresponsible way to fund our most basic national security priorities,” White House spokesman Josh Earnest said last week.

The National Defense Authorization Act also prevents the closing of the US military prison at Guantanamo Bay, Cuba, despite objections from human rights organizations and Obama.

The United States spends more on its military than any other nation in the world. The US spent $610 billion on defense in 2014, followed by China with $216 billion and Russia with $84.5 billion, according to the Stockholm International Peace Research Institute.

The US Congress has omitted a plan to shut down the Guantanamo Bay military prison from an annual defense authorization bill.

In this March 1, 2002 file photo, a detainee is escorted to interrogation by US military guards in the the Guantanamo Bay military prison, Cuba.

The American Civil Liberties Union, which has campaigned for the Guantanamo Bay prison's closure, hailed Obama’s veto.

"The president clearly did the right thing by rejecting the bill's restrictions on transferring Guantanamo prisoners who have been locked up without charge or trial for years on end," said executive director Anthony Romero.

"Now Congress needs to send back the president a bill that will let him close Guantanamo and end indefinite detention, and he needs to take decisive action to make his promise to close the prison a reality. He needs to do this soon, before his legacy is irreparably tarnished by the stain of Guantanamo," Romero added.

Obama had promised to close the Guantanamo Bay prison before his election in 2008, citing its damage to the US reputation abroad. But, later on the president backed away on his campaign promise due to stiff opposition from Congress.

As many as 775 detainees have been brought to the Guantanamo Bay prison, which was set up after the September 11, 2001 attacks. There are still 116 inmates at the prison.

Washington says the prisoners are terror suspects, but has not pressed charges against most of them in any court. Many detainees have been on hunger strike for months to draw attention to their conditions at the US military prison.