July 21, 2009 -- Senators put the brakes on a controversial effort to buy seven pricey fighter jets with taxpayer money today, avoiding a showdown that had promised to set the stage for President Obama's first potential veto.

In a victory for the president, the Senate voted 58-40 to remove $1.75 billion for the F-22 jets from a bill being considered on Capitol Hill. Money to buy the radar-evading fighter planes that have not seen combat in Iraq or Afghanistan will not be included in the Senate version of this year's defense authorization measure.

Both the president and Defense Secretary Robert Gates expressed their satisfaction shortly after the vote.

Obama immediately said he was "grateful" to the Senate for its vote, calling funding for F-22s "an inexcusable waste of money."

"Secretary Gates appreciates the careful consideration Senators have given to this matter of national security and he applauds their bipartisan support to complete the F-22 program at 187 planes," Pentagon Press Secretary Geoff Morrell in a statement. "He understands that for many members this was a very difficult vote, but he believes that the Pentagon cannot continue with business as usual when it comes to the F-22 or any other program in excess to our needs."

Both the Pentagon and the White House had urged lawmakers not to fund the plane, threatening a veto if senators kept the money in the measure. But lawmakers from several states where the aircraft is made said the project creates jobs back home.

For that reason, it was a debate that did not split neatly down party lines. Obama sided with former rival, Arizona Republican Sen. John McCain, in hopes of removing the funding. Sens. Christopher Dodd, D-Conn., Joe Lieberman, I-Conn., and Saxby Chambliss, R-Ga., were adamant about keeping the money in the bill.

Today an impassioned Dodd called the successful effort to remove funding for the F-22 "a dangerous amendment," adding, "The F-22, by any estimation, is the most superior aircraft in the world."

Dodd warned that removing money for the jet would cost his state 2,000 to 4,000 jobs, in addition to several thousand more job losses elsewhere.

"In a time when unemployment rates are skyrocketing, this body is about to lay off anywhere from 25,000 to 90,000 people," Dodd said before the vote.

"The F-22 has not flown one mission over Afghanistan or Iraq because it is not designed to meet the challenges we are currently facing," Sen. Ted Kaufman, D-Del., countered today on the Senate floor. As senators debated the F-22 money for two hours this morning, Kaufman added that the jet was made for "the wars of the past -- the wars we've already won."

"What I have not heard [from members of Congress] is a substantive reason for adding more aircraft in terms of our strategic needs," Gates said Monday.

"Some of the wheeling and dealing on the Hill, of a few hundred million here and a few hundred million there, for a pet project here and pet project there, confront us with ever more difficult choices when we're trying to make trade-offs in terms of how do we help our soldiers out -- how do we relieve the stress on the force," Gates said. "The money's gotta come from somewhere."

The administration has argued that the money could be put to better use for weapons like F-35 planes designed to be used by the Air Force, Marines, and Navy as well as key American allies. The F-35 fighter jet program that could eventually number 2,443 planes and cost $1 trillion.

On Monday, Gates said that by axing the program to fund the F-22, there "would be a substantial increase in the number of jobs in the aerospace industry."

"The F-35 already has 38,000 employees," Gates said. "That will go to 64,000 in FY '10 and 82,000 in FY '11 if we don't drain money away from it."

"To continue to procure additional F-22s would be to waste valuable resources that should be more usefully employed to provide our troops with the weapons that they actually do need," Obama wrote in July 13 letters to Sens. McCain and Carl Levin, D-Mich., urging them to remove the funding.

Debate over other elements of the broad defense bill will continue throughout the week on the Senate floor.

Full House and Senate Committee Have Voted for F-22s

The president's veto threat paid off.

In late June, a White House statement said "the President's senior advisors would recommend a veto" if the bill sent to the president's desk contained F-22 money.

That statement said the White House "has serious concerns with a number of provisions that could constrain the ability of the Armed Forces to carry out their missions, that depart from Secretary Gates' decisions reflected in the President's Fiscal Year 2010 Budget which carefully balanced fiscal constraints, program performance, strategic needs and capabilities, or that raise other issues."

"I think the President has outlined projects, as well as the Secretary of Defense, that he believes are not necessary spending," White House press secretary Robert Gibbs said June 25.

A total of 187 of the F-22 jets are already under contract but Gates has said it isn't logical to order more.

"That is all that we need to buy, that is all we can afford to buy and that is all we should buy," Levin agreed today on the Senate floor.

But other lawmakers who ultimately lost the debate felt otherwise.

"The Air Force has repeatedly warned that stopping this program at 187 aircraft would place our nation at 'higher risk', and that is not a risk I am willing to accept," Lieberman said in a statement when a Senate committee approved the measure. "Continued production of the F-22A will guarantee that we have balanced combat air forces in the future to support the transition between the F-22A and F-35 Joint Strike Fighter programs."

"It is regrettable that the administration needs to issue a veto threat for funding intended to meet a real national security requirement that has been consistently confirmed by our uniformed military leaders," Chambliss said June 25.

On June 25, the House passed its $680 billion version of the defense authorization bill with an F-22 provision included. Unlike the Senate version, the House version calls for the government to buy additional parts for the F-22, but doesn't specify how many aircraft should be purchased.

On June 26, the Senate Armed Services Committee approved the bill, sending it to the full Senate after voting in favor of more F-22s.

Some lawmakers have also said F-22s could help protect the nation from seaborne cruise missiles and Somali pirates. Gates said last week that fending off pirates is "a job we know is better done by three Navy SEALs."

Back in April, Gates announced plans to cut programs from the Defense Department that no longer made sense, including the plan to eliminate the F-22 fighter program as expected.

His proposed changes needed to be approved by Congress before taking effect.

"We stand at a crossroads," Gates said last week. "We simply cannot risk continuing down the same path -- where our spending and program priorities are increasingly divorced from the very real threats of today and the growing ones of tomorrow."

ABC News' Jake Tapper and Devin Dwyer contributed to this report.