Sen. John F. Kerry (D-Mass.) testified before the Senate Foreign Relations Committee for his confirmation hearing for Secretary of State. (The Washington Post)

His confirmation to be secretary of state virtually assured, Sen. John F. Kerry sketched a pragmatist’s view of the world Thursday, telling his Senate colleagues that the war in Syria may grind on indefinitely and that Iran may rebuff peaceful efforts to scale back its nuclear program.

Kerry’s nearly four-hour confirmation hearing covered his views on topics new and old, including the Middle East, China’s appetite for African energy and resources, North Korean gulags and his beloved Boston Red Sox.

The Senate Foreign Relations Committee is expected to vote as soon as next week to confirm Kerry (D-Mass.). The full Senate could take up his bid quickly. Senate insiders said Kerry could take over for Secretary of State Hillary Rodham Clinton in early February.

After shaking hands with Democrats and Republicans on the committee, which he has chaired for four years, Kerry moved to the witness table and said it was “humbling” to sit before his colleagues in his new role as a nominee.

“I’m particularly aware that in many ways, the greatest challenge to America’s foreign policy will be in your hands, not mine,” Kerry told the senators. “I am especially cognizant of the fact that we can’t be strong in the world unless we are strong at home,” a challenge in these days of fiscal stress, he added.

Kerry outlined no grand agenda for the next four years. The closest he got to a foreign policy mission statement was the observation that “more than ever, foreign policy is economic policy.” That means the United States must do better in the global competition for resources and markets, where it is being outmaneuvered by more nimble or aggressive nations, he said.

“Every day that goes by where America is uncertain in that arena, unwilling to put our best foot forward and win, unwilling to demonstrate our resolve to lead, is a day in which we weaken our nation itself,” Kerry said.

Asked about the personal bond he once had with Syrian President Bashar al-Assad, Kerry said the hopes he once had for an opening with Syria are moot. “Sometimes there are moments where you may be able to get something done in foreign policy, and if the moment somehow doesn’t ripen correctly or get seized, you miss major opportunities,” Kerry said.

He has been called naive for thinking Assad might become a political reformer. Now he sounds resigned to a continuation of the bloody factional fight.

“Right now, President Assad doesn’t think he’s losing, and the opposition thinks it’s winning,” Kerry said. “That is not an equation that allows you to reach some accommodation for transition.”

But when pressed by Sen. John McCain (R-Ariz.) about getting more directly involved in helping the Syrian rebels, Kerry said he needs time to understand the situation better.

On Iran, he said that negotiation is the better path but that if Iran refuses to talk in a meaningful way, “we will do what we must.” That was a sum-up of the Obama administration’s two-pronged, and so far unsuccessful, attempt to offer Iran a deal while threatening military action if it pushes on toward a nuclear weapon.

“I’d say this to the Iranians. I hope they listen,” Kerry said. “They have continually professed the peacefulness of their program. It is not hard to prove a peaceful program. Other nations have done that and do it every day” by allowing full and intrusive inspections.

U.S. foreign policy is defined by more than military intervention abroad and the fight against terrorism, he said, calling for consensus on promoting American leadership on matters ranging from food security to climate change.

“Climate change is not something to be feared” in terms of the steps needed to respond to it, notably the pursuit of clean-energy technology, Kerry said. “This $6 trillion market is worth millions of American jobs . . . and we’d better go after it.” Kerry would not say whether he would approve the Keystone XL pipeline.

“It will not be long before that comes across my desk, and at that time, I’ll make the appropriate judgments about it,” Kerry said.

He offered appraisals that reflected his nearly 29 years as a Senate veteran and his wide foreign policy experience. Unbidden, Kerry referred to the humanitarian crisis in Sudan’s South Kordofan region and rattled off the names of foreign leaders and diplomats.

Kerry has often carried difficult messages for President Obama, even if he was not a particularly close confidant during Obama’s first term. The senator has undertaken sensitive diplomatic missions for the president to Syria, Egypt, Pakistan and Afghanistan.

As chairman of the Foreign Relations Committee since Vice President Biden left the Senate four years ago, Kerry has criticized Obama’s policies at times. Last year, he called the Afghan war “unsustainable” and said the president should speed up the withdrawal of U.S. troops — a recommendation the administration appears on the verge of adopting. In 2011, he called for U.S. intervention in Libya before Obama decided to do so.

Kerry urged a bipartisan approach to policy issues, something on display when McCain joined Clinton and Sen. Elizabeth Warren (D-Mass.) in introducing him at the start of the hearing. Kerry and McCain have clashed over policies and politics, but they have remained friends.

As Kerry finished his opening remarks, a woman shouted from the rear of the hearing room: “I’m tired of my friends in the Middle East dying!”

Kerry told Sen. Robert Menendez (D-N.J.), who was presiding over the hearing, that he respects the woman’s opinion and her right to voice it. He recalled that he once testified before Congress as a war protester. “People measure what we do,” Kerry said. “In a way, that’s a good exclamation point to my testimony.”

Karen DeYoung and Juliet Eilperin contributed to this report.