Correction: An earlier version of this story incorrectly said that outgoing Defense Secretary Leon Panetta’s dog, Bravo, is an Irish setter. Bravo is a golden retriever. The story has been updated.

President Obama paid tribute Friday to outgoing Defense Secretary Leon E. Panetta, hailing him for presiding over victories against terrorists and the expansion of opportunity in the U.S. armed forces.

In a speech at Fort Myer, Va., for the “Armed Forces Farewell Tribute” to Panetta, the president called the Pentagon chief “a man who hasn’t simply lived up to the American dream but has helped to protect it for all of us.”

He told Panetta, who served as CIA director before taking the helm at the Pentagon, “Your leadership of the CIA will forever be remembered for the b lows that we struck against al-Qaeda” and for “delivering justice to Osama bin Laden.”

Obama added: “Because we believe in opportunity for all Americans, the tenure of Secretary Panetta” as defense chief “will be remembered for historic progress in welcoming more of our fellow citizens to military service.” He referred to the 2011 repeal of the “don’t ask, don’t tell” policy that barred openly gay people from serving in the military, and to the lifting last month of a ban on women in combat positions.

Obama spoke after a ceremony featuring military bands and honor guards, including the Old Guard Fife and Drum Corps clad in red coats and tricornered hats.

“I’ve witnessed a new generation of Americans ask themselves what they could do for their country,” Panetta said after being introduced by Obama.

“We’ve kept pressure on al-Qaeda, and we’re going after extremists wherever they may hide,” he said. “We have shown the world — we have shown the world — that nobody attacks the United States of America and gets away with it.”

Panetta formally announced his retirement early last month, and Obama nominated Chuck Hagel, a Republican former senator from Nebraska, to replace him. Hagel’s nomination has run into stiff opposition from Senate Republicans, who accused him of being insufficiently supportive of Israel and soft on Iran during an eight-hour confirmation hearing last week.

“It’s pretty obvious that the political knives were out for Chuck Hagel,” Panetta said in an interview that aired Sunday on NBC’s “Meet the Press.”

In one of his final acts as defense secretary, Panetta testified Thursday before the Senate Armed Services Committee about attacks on U.S. compounds in Benghazi, Libya, that killed four Americans in September. Responding to questions, he and Gen. Martin Dempsey, chairman of the Joint Chiefs of Staff, said they favored supplying weapons to Syrian rebels, a position that put them at odds with the White House.

Panetta also warned that the United States risks becoming a “second-rate power” if automatic spending cuts known as the “sequester” take effect as currently scheduled March 1 in the absence of a deficit-reduction deal to avert them, the Associated Press reported.

If that happens, he said, the U.S. military would face its worst readiness crisis in more than a decade. A forced budget cut of $42.7 billion from March through September, on top of $487 billion in defense reductions already mandated over the next 10 years, would leave the armed forces “hollow,” Panetta said.

“Instead of being a first-rate power in the world, we’d turn into a second-rate power,” Panetta told the committee, adding that it would be irresponsible for Congress to allow sequestration to go ahead. Sequestration “was not designed as a mechanism that was supposed to happen,” Panetta said. “It was designed to be so nuts that everybody would do everything possible to make sure it didn’t happen.”

In his tribute speech Friday, Obama alluded to the controversy over the looming deep cuts, saying that “there is no reason — no reason — for that to happen.” He called on Democrats and Republicans in Congress to “come together in the same spirit” that Panetta has shown in his nearly 50 years in public service.

“You’re a reminder of what public service ought to be,” Obama told the departing defense chief. “Whatever the challenge, Leon, you always give it to us straight — sometimes in words that can’t be repeated in public.”

Obama also lauded Panetta for “sharing” his golden retriever, Bravo, “the first dog of the Pentagon,” who sat with Panetta’s family in the audience.

Panetta noted in his speech that Bravo “was in all of the meetings when we planned the bin Laden operation,” adding: “He has never told a soul what he heard. He is definitely not a leaker — at least according to that definition of the word.”

Panetta, 74, took office as defense secretary in July 2011, succeeding Robert M. Gates, a holdover from the George W. Bush administration, who retired after 4 1/2 years on the job. Panetta was confirmed by the Senate in June 2011 on a 100-0 vote, a reflection of congressional appreciation for his service as director of the CIA for the previous two years.

As CIA chief, Panetta presided over an escalation of strikes against the al-Qaeda terrorist network, including the May 2011 raid by U.S. Navy SEALs that killed Osama bin Laden at his hideout in Abbottabad, Pakistan. During Panetta’s CIA tenure, drone strikes against al-Qaeda and affiliated militants in Pakistan increased markedly, a tactic he embraced.

“These operations have been very effective because they have been very precise in terms of targeting, and it involved a minimum of collateral damage,” Panetta said in May 2009. “Very frankly, it’s the only game in town in terms of confronting and trying to disrupt the al-Qaeda leadership.”

Before joining the Obama administration, Panetta and his wife, Sylvia Panetta, served as directors of the Panetta Institute for Public Policy, which they founded in 1998 at California State University, Monterey Bay.

The Panettas live on a 12-acre walnut farm in Carmel Valley, Calif., and the cost of his frequent trips home on military aircraft stirred controversy during his term as Pentagon chief.

From 1977 to 1993, Panetta served as a Democratic congressman from California representing parts of Santa Clara County and San Jose. He joined the administration of President Bill Clinton in 1993, serving as budget director for a year and a half before becoming Clinton’s chief of staff, a post he held from 1994 to 1997.