WASHINGTON - Defense Secretary Leon E. Panetta warned Congress on Tuesday that the budget stalemate and lawmakers' spending choices were among the greatest threats to the U.S. military.

If the fiscal cliff's automatic cuts are not avoided, the Pentagon could face about $500 billion in across-the-board budget reductions, he said.

Speaking as lawmakers try to wrap up negotiations on a defense bill, he said defense officials had built a budget that tries to protect military readiness while also providing needed services to troops who have been involved in wars for more than 11 years.

"Nevertheless, there is pressure on the department to retain excess force structure and infrastructure instead of investing in the training and equipment that makes our force agile and flexible and ready," Panetta said in a speech at the National Press Club.

"Aircraft, ships, tanks, bases, even those that have outlived their usefulness have a natural political constituency. Readiness does not. What's more, readiness is too often sacrificed in favor of a larger and less effective force. I am determined to avoid that outcome."

He complained that lawmakers had taken about $74 billion in proposed budget savings and diverted them to programs the Pentagon does not need.

While Panetta also offered an optimistic view of the Afghanistan war, he said that other threats - from al-Qaeda-linked terrorists and cyberattacks to hostile powers such as Iran - were growing.

Just days after he returned from his most recent trip to Afghanistan, Panetta spoke optimistically about the war effort there. He said that the international military coalition had managed to reverse a five-year trend of growing violence and that Afghan forces were on track to take the lead for securing the entire country next year.

By all accounts, Panetta is in the final weeks of his tenure as Pentagon chief. Chuck Hagel, a former Republican U.S. senator from Nebraska, is considered the leading contender for the job.