Updated

U.S. Defense Secretary Robert Gates told University of Notre Dame graduates on Sunday that the nation's security and prosperity depend on making sure the armed forces get the necessary equipment, training and funding, even in the face of a federal budget crisis.

Gates gave the commencement address at Notre Dame Stadium in South Bend, where 3,100 students graduated.

"Beyond the current wars, our military credibility, commitment and presence are required to sustain alliances, to protect trade routes and energy supplies, and to deter would-be adversaries from making the kind of miscalculations that so often lead to war," said Gates, who also received an honorary degree from the school.

He said it's important not to lose sight of the nation's global security needs as the federal government deals with its large budget deficit.

Cuts are necessary, he said, "but going forward, we must be clear-eyed about the fact that there are no painless answers."

The defense secretary compared today's hard times to those in the past, saying the nation has triumphed before and will do so again.

"We have battled slavery and intolerance in our own society, and on the global stage prevailed against Nazi Germany and Soviet communism," Gates said in his speech, which the Pentagon released. The Associated Press obtained a copy.

"We have seen periods of painful economic collapse give way to renewed and unprecedented prosperity," he said. "Our progress has been sometimes unsteady, and sometimes too slow. Winston Churchill purportedly said during World War II, 'You can always count on Americans to do the right thing - after they've tried everything else.'"

The U.S. has been and remains the envy of the world, Gates told graduates and their families.

"Indeed, the death of Osama bin Laden after a decade-long manhunt by the United States reminded us earlier this month that, as President Obama said, when faced with tough times, 'We do not falter. We don't turn back. We pick ourselves up and we get on with the hard task of keeping our country strong and safe,'" Gates said.

He warned against heeding calls for shrinking the nation's global commitments and military size and capabilities to deal with budget problems.

"As part of America getting its financial house in order, the size of our defense budget must be addressed," Gates said. "That means culling more bureaucratic excess and overhead, taking a hard look at personnel levels and costs, and re-examining missions and capabilities to separate the desirable or optional from the essential."

Another danger, he said, is the historic temptation for the nation to lower its guard and relax when threats seem less pressing.

"A recurring theme in America for nearly a century has been a tendency to conclude after each war that the fundamental nature of man and the iron realities of nations have changed," Gates said. "That history, in all of its unpredictable and tragic dimensions, has come to a civilized end, that we will no longer have to confront foreign enemies with size, steel and strength."