President Barack Obama speaks before vetoing the National Defense Authorization Act (NDAA), Thursday, Oct. 22, 2015, in the Oval Office of the White House in Washington. The president vetoed the sweeping $612 billion defense policy bill, citing objections over how the measure is funded. (AP Photo/Susan Walsh)

WASHINGTON (AP) — President Barack Obama vetoed a sweeping $612 billion defense policy bill Wednesday in a rebuke to congressional Republicans, and insisted they send him a better version that doesn’t tie his hands on some of his top priorities.

In an unusual Oval Office ceremony, Obama praised the bill for ensuring the military stays funded and making improvements on armed forces retirement and cybersecurity. Yet he pointedly accused Republicans of resorting to “gimmicks” and prohibiting other changes needed to address modern security threats.

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

In no mood to negotiate, Republicans vowed to muster the votes to override him.

The rare presidential veto marked the latest wrinkle in the ongoing fight between Obama and Republicans who control Congress over whether to increase federal spending — and how.

Four years after Congress passed and Obama signed into law strict, across-the-board spending limits, both parties are eager to bust through the caps for defense spending. But Obama has insisted that spending on domestic programs be raised at the same time, setting off a budget clash with Republicans that has yet to be resolved.

To sidestep the budget caps, known in Washington as sequestration, lawmakers added an extra $38.3 billion to a separate account for wartime operations that is immune to the spending limits. The White House has dismissed that approach, arguing it fails to deal with the broader problem or provide long-term budget certainty for the Pentagon.

Obama also rejects the bill as written due to provisions making it harder for him to transfer suspected terror detainees out of the military prison in Guantanamo Bay, Cuba, a key campaign promise that Obama is hard-pressed to fulfill before his term ends. The White House has also expressed concerns over provisions preventing military base closures and funding equipment beyond what the military says it needs.

Republicans erupted in near-universal criticism. Sen. John McCain, R-Ariz., the Senate Armed Services Committee chairman, called the veto “misguided, cynical and downright dangerous.” And more than a dozen House and Senate Republicans, including Iraq and Afghanistan veterans, joined in accusing Obama of putting politics ahead of the troops.

“Congress should not allow this veto to stand,” said House Speaker John Boehner.

The veto forces Congress to revise the bill or try to settle the larger budget dispute. Although Republicans have vowed to try to override the president’s veto, the White House and House Democratic leader Nancy Pelosi insisted Democrats had the votes to ensure Obama’s veto stays in place.

Obama has vetoed only a handful of bills before, generally in private. In an effort to call attention to his concerns, the White House invited reporters and photographers to witness him vetoing the bill.