Just four weeks after the U.S. House of Representatives voted by an overwhelming margin to begin buying a dozen more F-22s, the representatives reversed themselves July 30 and approved a defense appropriations bill that would end the stealth-fighter program.

Why the difference? President Barack Obama, the U.S. Air Force and Lockheed Martin.

“I think when the president made it clear that he would veto a bill containing F-22 funding, the House and Senate have both indicated that they do not wish to risk a veto over that one issue,” said Scott Lilly, a former staff director of the House Appropriations Committee.

The defense appropriations bill provides $640.4 billion for the U.S. military for 2010. That includes $128.2 billion for fighting the wars in Iraq and Afghanistan. F-22 funding was a fraction of a percent of the total, not enough for many lawmakers to risk the whole bill, Lilly said.

“The veto threat really made a difference,” agreed Christopher Hellman, a defense budget specialist for the Center for Arms Control and Non-Proliferation. “When the president says he’s going to veto a bill, it means something.”

Lockheed, which builds the F-22 Raptor, also influenced the vote, mainly by its silence, said Loren Thompson, a defense analyst at the Lexington Institute, Arlington, Va. “For the first time ever, the Air Force and the contractor were not lobbying to save the program,” Thompson said.

Indeed, senior Air Force officials testified against buying more Raptors. For Lockheed, it became a matter of sacrificing the F-22 to preserve the much more lucrative F-35 Joint Strike Fighter, he said.

The F-35 is “the biggest defense program in the history of the world.” Ultimately, it may be worth more than $1 trillion to Lockheed. “It’s absolutely huge,” Thompson said. Lockheed decided not to anger the Obama administration – and possibly endanger the F-35 – by crossing swords with Defense Secretary Robert Gates “over a few additional F-22s,” Thompson said.

The U.S. military plans to buy 2,443 F-35s, and eight foreign countries are expected to buy hundreds more.

“For the contractor, the quid pro quo was clear,” Thompson said. “Cease and desist on the F-22 and keep the F-35.”

Gates, too, helped prepare the way for votes against the F-22, Thompson said. In June 2008, he forced Air Force Secretary Michael Wynne and Gen. Michael Moseley, the service’s chief of staff, to resign. The immediate cause was lax Air Force handling of nuclear weapons.

But Moseley and Wynne had repeatedly clashed with Gates over the F-22. They wanted more stealth fighters and Gates did not. Those factors were bubbling in the background when Obama issued his veto threat.

Before the House voted on the defense authorization bill, the White House warned that if the bill included funding for more F-22s, “the president’s senior advisers would recommend a veto.”

The House ignored the warning and passed the bill with F-22 funding by 389-22.

By July 15, as the Senate was preparing to vote on its version of the authorization bill, Obama’s position had hardened. This time, the White House warned that if the final bill contained F-22 money, “the president will veto it.”

The Senate removed F-22 funding and passed its defense authorization bill by unanimous consent.

The White House issued the same veto admonition to the House on July 28, two days before the vote on the defense appropriations bill, which provides the actual money for authorizations. The House voted 269-165 to pass an amendment that would shift $369 million slated to buy parts for new F-22s to purchase spare parts and engines for existing aircraft.

The House then passed the 2010 Defense Appropriations Act by 400-30.

It looks like the end of the production line for the F-22, said Mandy Smithberger of the Project on Government Oversight, which has long opposed the F-22 as overpriced and built for a threat that no longer exists.

But, Smithberger cautioned, nothing is final until versions of the authorization and appropriations bills are passed by Congress and signed by the president. The Senate has yet to vote on its version of the appropriations bill.

Conceived in the early 1980s to battle Soviet fighters over Europe, the F-22 was plagued by production delays and cost overruns. The first planes didn’t become operational until late 2005, and by then they cost about $360 million per plane, including development costs. They have not yet flown in combat.

“This thing has got more lives than a vampire,” Hellman said. Right now, the F-22’s future looks bleak, but the production line will turn out F-22s for several more years, he said.

A new study – possibly the 2010 Quadrennial Defense Review – may recommend producing more F-22s, or a change in the threat environment could revive the program.

“Until I see its severed head, I’m not ready to rule it totally out at this point,” Hellman said.