In his last State of the Union address, President Obama took shots at Republican presidential candidates, expressed one of his "few regrets," and said he's "as confident as I have ever been that the state of our union is strong." (Sarah Parnass/The Washington Post)

In his last State of the Union address, President Obama took shots at Republican presidential candidates, expressed one of his "few regrets," and said he's "as confident as I have ever been that the state of our union is strong." (Sarah Parnass/The Washington Post)

President Obama used his final State of the Union address to consider himself as an ex-president — talking in conversational, contemplative and backward-looking terms at the country he would leave behind, and warning not-very-subtly that the country shouldn’t pick Donald Trump to take his place.

“As frustration [with politics] grows, there will be voices urging us to fall back into tribes, to scapegoat fellow citizens who don’t look like us, or pray like us, or vote like we do, or share the same background,” Obama said, one of several moments when he seemed to be referencing the Republican front-runner’s suspicious attitude toward immigrants and Muslims. “We can’t afford to go down that path. It won’t deliver the economy we want, or the security we want, but most of all, it contradicts everything that makes us the envy of the world.”

[Fact checks, reactions and more on the live blog]

Obama’s speech came with more than a year – a full one-eighth of his term – still remaining in the White House. But he seemed to be already thinking of what the place would look like without him and trying to balance confidence in his achievements (“ Ask Osama bin Laden,” he said at one point, touting his anti-terror credentials) with acknowledgements that many Americans didn’t feel as good about the Obama era as he did.

“I believe in you,” Obama said, as he closed. “That’s why I stand here confident that the State of our Union is strong.”

History shows that presidents delivering their final State of the Union address take the opportunity to frame their time in office and begin to cement their legacy. (Peter Stevenson/The Washington Post)

Earlier in the speech, Obama said that “one of the few regrets” of his presidency was that — after he ran on a message of unity and healing — American politics had become more divided and resentful on his watch.

“It’s one of the few regrets of my presidency — that the rancor and suspicion between the parties has gotten worse instead of better,” Obama said, according to an advance text of his speech. “There’s no doubt a president with the gifts of Lincoln or Roosevelt might have better bridged the divide, and I guarantee I’ll keep trying to be better so long as I hold this office.”

In the same speech, Obama used his moment of national attention to rebuke at least two of the Republicans running to replace him – though never by name.

He seemed to be talking about Sen. Ted Cruz (Tex.), who had called for carpet-bombing the Islamic State in Syria, when Obama said: “Our answer needs to be more than tough talk or calls to carpet bomb civilians. That may work as a TV sound bite, but it doesn’t pass muster on the world stage.”

And, at a number of moments, Obama seemed to be talking about Trump. “When politicians insult Muslims . . . that doesn’t make us safer. That’s not telling it like it is. It’s just wrong,” Obama said, apparently referencing Trump’s call to ban Muslim foreigners from entering the country. “It diminishes us in the eyes of the world.”

[Barack Obama’s case against Donald Trump]

Both Republicans in their campaigns have tried to play up the threat the Islamic State poses to the United States. But the president said the Islamic State does not pose an existential threat to the United States – and argued that over-playing its danger only reinforces the Islamist group’s self-aggrandizing message as he often sought to acknowledge Americans’ fears and deflate them at once in his speech.

1 of 37 Full Screen Autoplay Close Skip Ad × The scene as Obama delivers his final State of the Union address View Photos Embarking on a final year in office, President Obama gave his seventh State of the Union address before a joint session of Congress. Caption Embarking on a final year in office, President Obama gave his seventh State of the Union address before a joint session of Congress. Jan. 12, 2016 President Obama enters the chamber to deliver his State of the Union address before a joint session of Congress. Melina Mara/The Washington Post Buy Photo Wait 1 second to continue.

“As we focus on destroying ISIL, over-the-top claims that this is World War III just play into their hands. Masses of fighters on the back of pickup trucks and twisted souls plotting in apartments or garages pose an enormous danger to civilians and must be stopped. But they do not threaten our national existence,” Obama said. The message, like many in the speech, seemed aimed at the Republicans’ bleak views of America’s future, and the country’s vulnerability to terrorists.

“We don’t need to build them up to show that we’re serious, nor do we need to push away vital allies in this fight by echoing the lie that ISIL is representative of one of the world’s largest religions,” Obama said.

[Annotated transcript: What Obama said, and what it meant]

The president used the speech to pose “four big questions” about the future of the country.

“Will we respond to the changes of our time with fear, turning inward as a nation, and turning against each other as a people?” Obama said. “Or will we face the future with confidence in who we are, what we stand for, and the incredible things we can do together?”

Obama’s questions began with one about the economy – “how do we give everyone a fair shot at opportunity and security in this new economy?” Another asked how America could solve technological problems like curing cancer and halting climate change. Another asked how the U.S. could avoid becoming the world’s policeman. And the last asked how Americans could learn to reason together, giving up the bitter gridlock of today’s Washington.

For each question, the answer was implicit: How should Americans tackle these things? By following Obama’s ideas from the past seven years, even those that never came to pass.

“We’ve made progress,” Obama said, in answering the first question. It might have been the answer to all. “But we need to make more.”

Obama used the moment to reassure Americans – or at least try to – that worries raised about the economy and national security were overblown. “The United States of America, right now, has the strongest, most durable economy in the world,” he said at one point.

“The United States of America is the most powerful nation on Earth. Period. It’s not even close,” he said later.

GOP response

Trump’s impact on the 2016 presidential race – and the country – was obvious not just in Obama’s prepared remarks, but in those of the Republican offering the GOP’s official response. South Carolina Gov. Nikki Haley had prepared a speech that called for Republicans to respect and welcome immigrants, saying they could love American values as much as the native-born.

It seemed likely to create an unusual moment of alignment, on a night when the two parties are usually keen to signal their differences.

Haley, who was her state’s first female and first Indian American governor, criticized Obama for having been too passive in the face of growing debt and threats like terrorists inspired by the Islamic State.

“The president’s record has often fallen far short of his soaring words. As he enters his final year in office, many Americans are still feeling the squeeze of an economy too weak to raise income levels,” she said. “Even worse, we are facing the most dangerous terrorist threat our nation has seen since September 11th, and this president appears either unwilling or unable to deal with it.”

But Haley, too, included an appeal to Americans to work together — and a message of tolerance toward immigrants. That stood in contrast to the message of her party’s leading presidential contender, Trump, about immigrants from Mexico and majority-Muslim countries.

“Immigrants have been coming to our shores for generations to live the dream that is America,” Haley said. Her parents immigrated from India. “During anxious times, it can be tempting to follow the siren call of the angriest voices. We must resist that temptation. No one who is willing to work hard, abide by our laws, and love our traditions should ever feel unwelcome in this country.”

For the last time

During his speech, Obama seemed looser and more conversational than in past State of the Unions.

He began with a lighthearted jab at the many, many people running to replace him. Of them, at least two were in the House chamber for the speech: Sen. Bernie Sanders (Vt.), running as a Democrat, and Sen. Marco Rubio (R-Fla.).

“For this final [address], I’m going to try to make it shorter,” Obama said. “I know some of you are antsy to get back to Iowa.”

And he returned to the topic of gasoline prices – the subject of many past Republican attacks – with a line that noted how low they’d gone.

“Under two bucks a gallon ain’t bad,” Obama said.

As he left the House chamber for the last time, he shook hands, signed autographs for members of Congress, then turned — a literal look back to follow the rhetorical ones in his speech.

“Let me look at this thing one last time,” Obama said.