Describing himself as “filled with gratitude,” Mr. Bush touched briefly on a handful of policy matters that he regards as achievements: his No Child Left Behind education measure, legislation giving Medicare beneficiaries access to prescription drugs and his campaign to combat AIDS around the world. But his main theme was the moment that defined his presidency, the Sept. 11 terrorist attacks.

Image Mr. Bushs audience included family, friends, staff members and some ordinary Americans. Credit... Doug Mills/The New York Times

“As the years passed,” Mr. Bush said, “most Americans were able to return to life much as it had been before 9/11. But I never did. Every morning, I received a briefing on the threats to our nation. And I vowed to do everything in my power to keep us safe.”

He went on to recount some of the decisions that flowed out of that vow: the creation of the Department of Homeland Security, the creation of “new tools to monitor terrorists” movements  tools that civil liberties advocates argue are unconstitutional. He did not mention his authorization of harsh interrogation techniques, another decision that has been among the most controversial and divisive of his presidency.

“There is legitimate debate about many of these decisions,” Mr. Bush said. “But there can be little debate about the results. America has gone more than seven years without another terrorist attack on our soil.”

In giving the speech, Mr. Bush carried on a tradition of farewell addresses that dates to George Washington and continued, most recently, with Presidents Ronald Reagan and Bill Clinton. (Mr. Bush’s father, the first President Bush, did not give a farewell address.) Mr. Reagan’s address, especially, was deeply personal, laden with wistful references and reflections of America as a “shining city on a hill,” the phrase coined by John Winthrop, a colonial-era governor of Massachusetts.

But unlike Mr. Reagan, who left office with his popularity ratings high, Mr. Bush leaves as one of the most unpopular presidents in modern times. Perhaps reflecting that, he kept his talk relatively short and to the point, with few rhetorical flourishes.

Instead, the president spoke somberly of the challenges that the nation faces in the years to come, as he warned Americans to resist the temptation to look inward and not to abandon his signature foreign initiative, the so-called freedom agenda, intended to promote democracy around the world.