"We don't have a domestic spying program," Obama also says.

Receive the latest entertainment-news updates in your inbox

President Barack Obama, left, talks with Jay Leno during a commercial break during the taping of his appearance on The Tonight Show with Jay Leno.

Updated at 10:10 AM EDT on Wednesday, Aug 7, 2013

President Barack Obama gave an unexpectedly serious and wide-ranging interview to Jay Leno on Tuesday night, weighing in on a terror threat, U.S. tensions with Russia and even his recent lunch with Hillary Clinton on "The Tonight Show" — a venue where he was more accustomed to light-hearted joking.

Obama used his appearance on the show – his sixth – to give his first public comments on recent warnings of a possible terrorist attack on U.S. interests in the Middle East. The warnings have prompted the State Department to shutter 19 diplomatic posts across the Middle East and North Africa until Saturday.

"Well, it's significant enough that we're taking every precaution," Obama said to Leno, adding that radical violet extremism "is still out there, we've got to stay on top of it."

Audience Members React to President’s "Tonight Show" Appearance

President Obama made his sixth appearance on the “Tonight Show” Tuesday. The President spoke to Jay Leno about the economy, his recent lunch with Hillary Clinton, and gay rights in Russia. Beverly White reports from Burbank for the NBC4 News at 6 p.m. on August 6, 2013. (Published Tuesday, Aug. 6, 2013)

The president also reiterated the White House's warning that the threat was significant and urged Americans to act "prudently" when planning travel and checking in with the State Department and embassies to see what precautions they should be taking.

"The general rule is show some common sense and some caution," Obama said, as the first sitting president ever to go on the show, making his fourth appearance since he took office.

He also said that Americans have shined in times of danger and peril, pointing out that people kept going to ball games and went on business as usual after the Boston Marathon bombings in April.

"That's the right reaction. Terrorists depend on the idea that we're going to be terrorized," Obama said.

"Tonight Show" Guests Surprised Obama Making Appearance

Guests of the "Tonight Show With Jay Leno" were surprised to find out a secret guests was scheduled to be President Barack obama, who was in town for his sixth taping of the show. Toni Guinyard has the report for the NBC4 News at noon on Tuesday, Aug. 6, 2013. (Published Tuesday, Aug. 6, 2013)

The president also commented on the case of National Security Agency leaker Edward Snowden, plus the secret government data surveillance programs his leaks to the press uncovered.

"We don't have a domestic spying program," Obama said, defending some surveillance as a "critical component to counterterrorism" and saying the information it gathered was "useful."

But NBC News' correspondent Andrea Mitchell told "The Rachel Maddow Show" Tuesday said that he also appeared to express some caution about the surveillance, suggesting some level of discomfort with the NSA's programs.

Obama didn't comment on the legality of Snowden's leaks. Snowden faces espionage charges for them and has been granted temporary asylum in Russia in the face of them.

Michelle Obama Style Guide

"We don't know exactly yet what he did," Obama said. "It's important for me not to prejudge something."

The president said he was disappointed by Russia's decision to grant Snowden asylum, but maintained that the U.S relationship with Russia is still intact.

"There's still a lot of business that we can do with them, but there are times when they slip back into Cold War thinking," Obama said.

He confirmed to Leno that he will attend the G-20 summit in St. Petersburg with Russian president President Vladimir Putin — despite some protests that he should not, due to Russia's granting Snowden asylum, and others over Russia's new spate of laws cracking down on gay Russians' civil rights. On Wednesday, however, Obama canceled a meeting with Putin that had been scheduled on the sidelines of the summit.

Leno himself told MSNBC host Lawrence O'Donnell in an interview on his show "The Last Word" Tuesday night, after the Obama taping, that the question of Russia — and of its crackdown on gay rights — was one he had most looked forward to asking Obama. The president said he had no patience for countries that try intimidate or harm gay, lesbian or transgender people and said it was his duty to speak out about basic freedoms.

Another topic Leno had most wanted to ask Obama about: The high-profile case of Trayvon Martin and his fatal shooting by George Zimmerman, who was acquitted of second-degree murder and manslaughter last month.

Leno praised the president's public comments on the case and on the experiences of black men and boys in America and asked him about his remarks.

"I think all of us were troubled by what happened," Obama told Leno. "It doesn't mean Trayvon was a perfect kid. None of us were."

Obama said he thought the attention paid to the Martin shooting was indicative of how badly Americans want a fair and just criminal justice system.

"What I wanted to explain was why this was a particularly sensitive topic for the African-American community," he continued. "The system should work for everyone, and what I'm trying to do is just make sure that we have a conversation."

On "The Last Word" Tuesday night, after taping, Leno said he had been particularly interested in hearing about the comments on the shooting's impact. "He put every American in the shoes of the average black teenage boy," Leno said.

Leno also asked the president about the economy and the constant partisan battles in Congress over whether to boost the economy with infrastructure projects and other spending. And it was also pointed out that the president's health care law goes into full effect on Oct. 1.

The late-night host also took a few swings at the president for becoming a bit closer to his 2008 presidential rival, John McCain, who was recently instrumental in pushing a comprehensive immigration bill through the Senate.

Obama's appearance on Leno's show wasn't all serious, however, and he managed to have at least some fun with the late night host, with the help of some chat about former Secretary of State Hillary Clinton, whom he lunched with recently.

"Who invited who to lunch?" Leno asked.

"I invited her, and we had a great time," Obama said. "She had that post-administration glow — you know, when folks leave the White House, and two weeks later they look great."

So was Clinton, a speculated 2016 presidential contender, measuring the Oval Office drapes for a possible future stint there?

"She's been there," Obama said of the former first lady. "She doesn't have to measure them."