President Obama devoted only a fraction of his State of the Union remarks to foreign policy, saying he had kept his promise to end the two wars in the Middle East but giving short shrift to the instability and violent unrest that remains in the region.

Obama has repeatedly said he wants to be remembered as the president who helped the country move beyond a decade-long period of wars and terrorism, and he used his address to Congress to remind Americans that he is on track to keep that promise.

In early remarks, Obama acknowledged the sacrifices of the long war in Afghanistan, saying that in “tight-knit communities across America ... [servicemembers] remember fallen comrades, and give thanks for being home from a war that, after twelve long years, is finally coming to an end.”

He concluded the speech with a heartfelt salute to Army Ranger Sgt. 1st Class Cory Remsburg, who was nearly killed by a massive roadside bomb in Afghanistan during his 10th deployment. Seated next to Michelle Obama, Remsburg gave a thumbs-up sign as lawmakers gave him a standing ovation.

The speech also cemented the administration's evolution in the way it describes its counterterrorism record, with Obama once again saying that “al Qaeda's core leadership is on a path to defeat,” a shift from his 2012 campaign stump speech, when he argued that the terrorist group that attacked the U.S. on Sept. 11 was “decimated” and “on the run.”

Although Obama acknowledged that the “danger remains” and al Qaeda has shifted resources and capabilities to new hotbeds of terrorism, including Yemen, Somalia, Iraq and Mali, he said his administration will remain committed to ensuring that terrorists do not launch attacks against the U.S.

The official end of the Afghanistan war will come with major troop withdrawals at the end of the year, but the Obama administration is still trying to negotiate a residual U.S. troop presence, mainly to buttress Kabul's military and its training, to carry out strikes on terrorists within the country's borders.

So far, however, Afghan President Hamid Karzai has flouted U.S. entreaties to sign a negotiated agreement spelling out the American military's role beyond 2014.

As part of a case he is building against America, on Monday he lashed out at the U.S. military for causing civilian casualties in counterterrorism raids, and went so far as to suggest that America may have aided or conducted insurgent-style attacks to undermine his government.

U.S. officials have angrily called the claims conspiracy theories. But Obama glossed over the standoff with Karzai, saying only that after 2014, “we will support a unified Afghanistan as it takes responsibility for its own future.”

“If the Afghan government signs a security agreement that we have negotiated, a small force of Americans could remain in Afghanistan with NATO allies to carry out two narrow missions: training and assisting Afghan forces, and counterterrorism operations to pursue any remnants of al Qaeda,” he said. He did not lay out the scenario if neither Karzai nor his successor sign the agreement.

The U.S. would like to leave as many as 10,000 troops in Afghanistan, but if Karzai or his successor refuses to allow the residual force, all American troops may be forced to depart by the end of the year.

Washington is growing increasingly impatient with Karzai's antics, and has warned that failing to sign the agreement could jeopardize humanitarian and economic assistance.

The Obama administration failed to negotiate a deal allowing a residual level of troops to remain in Iraq, and in recent months, that country has erupted in violent sectarian clashes that have given al Qaeda the renewed foothold the U.S. military worked hard to break in 2007 and 2008.

Foreign policy experts warn against leaving Afghanistan in the same vulnerable condition.

Obama only mentioned Iraq in passing, and said little about the re-emergence of al Qaeda strongholds there.

Addressing growing concerns in Congress and among the public over the Iran nuclear deal, Obama strongly defended it while pleading for more patience, especially in the Senate, where a new sanctions bill has strong bipartisan support and gained momentum in early January.

“These negotiations will be difficult. They may not succeed,” he acknowledged. “We are clear-eyed about Iran’s support for terrorist organizations like Hezbollah, which threaten our allies, and the mistrust between our nations cannot be wished away.”

On the sanctions bill in Congress, the president was resolute.

“Let me be clear: If this Congress sends me a new sanctions bill now that threatens to derail these talks, I will veto it,” he said. “For the sake of our national security, we must give diplomacy a chance to succeed.”

Only a few members stood up to support the president's warning on the sanctions bill amid tepid applause.

Earlier this month, the clock started ticking on a six-month deal to halt parts of Iran's nuclear program in exchange for nearly $4.2 billion in sanctions relief.

The coming months will test Tehran's commitment to complying with the deal with the goal of establishing a long-term, comprehensive agreement to permanently roll back Iran's nuclear capability.

But Iranian officials have sparked concern about their commitment to the long-term goal by publicly bragging that the U.S. has surrendered to Iran's will in the negotiations and arguing that the lower uranium enrichment could be easily reversed.

The administration's failure to make the details of the deal public — it released the full document to Congress and made public a partial summary — has only fueled fears that the Iranians can't be trusted and the deal concedes too much.

In addition to these two Middle Eastern flashpoints, Obama made a passing mention of Secretary of State John Kerry's renewed push for an Israeli-Palestinian peace process, although there is little progress to report. The talks began last year, but the two sides remain entrenched after months of negotiations with no breakthrough expected.

“As we speak, American diplomacy is supporting Israelis and Palestinians as they engage in difficult but necessary talks to end the conflict there, to achieve dignity and an independent state for Palestinians, and lasting peace and security for the State of Israel — a Jewish state that knows America will always be at their side,” he said.

More than any other foreign policy issue, the three-year civil war in Syria has vexed Obama. He was forced to backtrack on his red-line threat over chemical weapons to Syrian leader Bashar Assad, disappointing allies. But on Tuesday night, he cast the confrontation with the Syrian leader as a victory because it resulted in Assad agreeing to turn over and destroy his chemical stockpile.

“American diplomacy, backed by the threat of force, is why Syria’s chemical weapons are being eliminated, and we will continue to work with the international community to usher in the future the Syrian people deserve — a future free of dictatorship, terror and fear,” said Obama.

He made no mention of last week's international Syrian peace talks in Switzerland, which got off to a rocky start and aren't expected to move either side any closer to a transitional government to end the bloodshed.

Obama recently told New Yorker writer David Remnick that he is “haunted” by the civil war, which has killed more than 100,000, but has no plans for an American intervention that could dramatically turn the outcome to the opposition's favor.

House Foreign Affairs Committee Chairman Ed Royce, R-Calif., criticized Obama's foreign policy in a statement, saying that "much of the Middle East, North Africa and central Asia is in chaos."

“The terrorist threat has evolved and spread. Saying we are more secure, as the President did, doesn't make it so,” said Royce.

"No one opposes diplomacy with Iran, as the President suggested. What many in Congress do oppose is the deal he struck that lifts economic sanctions and guarantees that Iran can keep critical and dangerous nuclear technology. That hardly makes us more secure,” he continued.

Royce also cited the threat from a nuclear-armed North Korea.

"The President said his Administration is focused on bringing greater security to Asia, yet he didn't even mention the North Korean nuclear threat, which his Administration has ignored," the chairman said.