A gay-inclusive hate crimes bill attached to a must-pass defense bill has dodged a presidential veto threat and boosted its chances of passage after the Senate voted to kill provisions for a major Air Force fighter jet program Tuesday.

The vote was a major victory for President Obama, who had warned he'd veto the entire bill if it included a provision to fund seven twin-engine F-22 Raptors at a cost of $1.75 billion, the Washington Post reported.

Obama hailed the 58-40 vote: “At a time when we're fighting two wars and facing a serious deficit, this would have been an inexcusable waste of money.”

On a voice vote Thursday, senators agreed to attach Massachusetts Senator Ted Kennedy's Matthew Shepard Hate Crimes Prevention Act to the defense bill. The amendment adds disability, gender and sexual orientation to the list of hate crime protections. The law would also aid state and local governments prosecute hate crimes.

The bill is named after the University of Wyoming student who was killed in 1998 by two men he met in a gay bar. He was beaten and left to die shackled to a post along a rural road near Laramie.

Obama found an unlikely ally in Senator John McCain (R-Arizona). McCain, who has led Republican opposition to the hate crimes bill, backed the president and the Pentagon in opposing the fighter jet funding. The Arizona senator called the hate crimes add-on an “abuse of power” on the Senate floor Wednesday.

This is not to suggest that Republicans have softened their opposition to hate crimes legislation. On Monday they managed to pass several amendments to the bill opposed by supporters.

One amendment requires that hate crimes be identified and prosecuted based on “neutral and objective criteria,” while another adds the death penalty to the legislation. Another increases protections for U.S. military service members and their families. A fourth amendment would limit hate crime prosecutions in a state until its attorney general has established standards for applying the death penalty.

In a statement, the Human Rights Campaign (HRC), the nation's largest gay and lesbian rights advocate, criticized the amendments, three of which were offered by Judiciary Committee ranking member Jeff Sessions (R-Alabama).

“We urge Congress to eliminate these unwelcome amendments and send the Matthew Shepard Act to the president's desk quickly,” HRC President Joe Solmonese said.