At a news briefing on Friday, President Obama said that he spoke by phone with Iranian President Hassan Rouhani, another step in a warming relationship both leaders have said they hope ends with a diplomatic resolution to Iran's controversial nuclear program. (Thomas LeGro/The Washington Post)

As President Obama arrived in the White House briefing room Friday afternoon, the widespread assumption was that he would address a looming government shutdown.

But first, Obama announced some news from abroad — a historic conversation between him and the leader of Iran.

It was a clear sign that Obama may be following in the long tradition of second-term presidents, who have often turned to foreign affairs, rather than domestic pursuits, to cement their legacies.

Obama’s surprise announcement that he and Iran’s leader, Hassan Rouhani, had talked on the phone — the first such direct communication in three decades — offered the president a chance to show he was making progress on an issue of global importance.

Reaching an accord with Iran over its nuclear program could be “a major step forward,” Obama said, and “could bring greater peace and stability to the Middle East.”

But on the domestic side, Obama remains largely sidelined, watching as Congress careens toward a possible shutdown and as his own approval ratings drop in recent polls. In his remarks Friday, Obama appeared weary of Republicans in Congress who, in his eyes, have shown little interest in working with him.

Obama told Republicans to “knock it off” and said he wouldn’t be held hostage by their demands.

“We’re not going to do this under the threat of blowing up the entire economy,” he said. “That’s not how our constitutional system is designed.”

At times he seemed on the verge of laughter, and noted that the current debate is only focused on a short-term funding bill.

“We could be doing this all over again,” Obama said, adding with a note of sarcasm: “I’m sure the American people are thrilled about that.”

Even as he struggles for success in Washington, Obama has enjoyed some measured victories abroad in recent weeks. In the Middle East, a region that has offered disappointment to his predecessors, Obama is now focusing on a trio of potential deals.

In addition to the new potential path toward an agreement with Iran, Obama is working through the United Nations to eliminate Syria’s chemical weapons cache after a surprise Russian diplomatic offer averted U.S. strikes there earlier this month.

Obama has also tasked his secretary of state, John F. Kerry, with trying to secure a peace agreement with the Israelis and Palestinians by the middle of next year.

Obama’s schedule in the coming weeks underscores his continuing focus on foreign matters.

On Monday — the deadline for Congress to agree to keep the government funded — Obama is scheduled to meet with Israeli prime minister Benjamin Netanyahu at the White House. Then on Oct. 5, he will depart for a week-long trip to four countries — Indonesia, Brunei, Malaysia and the Philippines — where he will focus on expanding Asian markets for U.S. products.

As a shutdown has loomed, the White House said it has made no plans to delay the trip. Obama is scheduled to return from Asia only days before another deadline, Oct. 17, which marks the day that the government could run out of money if the federal debt ceiling is not raised.

The unexpected diplomatic openings on Syria and Iran both came as a result of circumstances partly outside Obama’s control.

Iranians elected Rouhani, who has made a choice to pursue a more moderate path than his predecessor, while Russia made a surprise diplomatic proposal for Syria to give up its chemical weapons cache in order to avoid strikes.

In a phone call with reporters Friday, a senior administration official said neither of the developments “could have been foreseen a month ago and both of which hold out the prospect of significant progress on issues that are hugely important to the United States and international community.”

The senior administration official said Friday’s call, which was initiated by Rouhani, could change the dynamics of ongoing negotiations over Iran’s nuclear program by providing “that push and that momentum from the presidential level to the negotiations” to reach a deal.

Many of Obama’s predecessors sought foreign policy achievements — and faced fresh foreign perils — in their second terms. George W. Bush launched a new approach in Iraq after violence was spiraling out of control in that country. Bill Clinton tried to bring peace to the Balkans, while Ronald Reagan helped bring an end to the Cold War.

But even while they acknowledged a focus on foreign policy, Obama’s advisers also insisted they could remain focused on domestic priorities — including, at the top of the list, an overhaul of immigration laws.

“The president frequently handles more than one important issue at a time,” said White House spokesman Josh Earnest. “It’s part of his job description, in the same way that it is Congress’s responsibility to pass a budget and pay the nation’s bills on time.”