WASHINGTON — President Barack Obama vowed in his second inaugural address on Monday to support efforts to widen democracy worldwide, including in the Middle East, and pledged that America would “act on behalf of those who long for freedom” while also remaining “the anchor of strong alliances in every corner of the globe.”

Obama declared that a decade of war is ending, the nation’s economy is recovering and “America’s possibilities are limitless” as he launched into a second term before a flag-waving crowd of hundreds of thousands.

“My fellow Americans, we are made for this moment, and we will seize it, so long as we seize it together,” Obama said, moments after taking the oath of office.

Trumpets blew fanfare and cannons fired as the country watched the president take the oath of office as the world’s most powerful elected leader.

Obama said that Americans “still believe that enduring security and lasting peace do not require perpetual war. Our brave men and women in uniform, tempered by the flames of battle, are unmatched in skill and courage,” he noted. “Our citizens, seared by the memory of those we have lost, know too well the price that is paid for liberty. The knowledge of their sacrifice will keep us forever vigilant against those who would do us harm,” he said. “But we are also heirs to those who won the peace and not just the war, who turned sworn enemies into the surest of friends, and we must carry those lessons into this time as well.”

The president vowed, “We will defend our people and uphold our values through strength of arms and rule of law. We will show the courage to try and resolve our differences with other nations peacefully – not because we are naïve about the dangers we face, but because engagement can more durably lift suspicion and fear. America,” he promised, “will remain the anchor of strong alliances in every corner of the globe; and we will renew those institutions that extend our capacity to manage crisis abroad, for no one has a greater stake in a peaceful world than its most powerful nation.

“We will support democracy from Asia to Africa; from the Americas to the Middle East,” he went on, “because our interests and our conscience compel us to act on behalf of those who long for freedom.”

The US, he said, “must be a source of hope to the poor, the sick, the marginalized, the victims of prejudice – not out of mere charity, but because peace in our time requires the constant advance of those principles that our common creed describes: tolerance and opportunity; human dignity and justice.”

Obama’s address touched on the broad gifts that bring the country together, and pointed to the work ahead, “the realities of our time.”

“We must make the hard choices to reduce the cost of health care and the size of our deficit,” he said. But we reject the belief that America must choose between caring for the generation that built this country and investing in the generation that will build its future.”

While he was officially sworn in Sunday, as required by law, the glitter of Inauguration Day — the parade down Pennsylvania Avenue toward the White House, the night of balls, the ceremonial beginning of a new four-year presidential term — still enlivened staid Washington. The celebration was pushed to Monday because Jan. 20 fell on a Sunday this year. That placed the grand ceremony on the U.S. holiday marking the birthday of revered civil rights leader Martin Luther King.

Obama, the politician who rose improbably from a history as a community organizer in Chicago and a professor of constitutional law to the pinnacle of power, faces a nation riven by partisan disunity, a still-weak economy and an array of challenges abroad.

The president also faces a less charmed standing on the world stage, where expectations for him had been so high four years ago that he was given the Nobel Peace Prize just months into his presidency. “Only very rarely has a person to the same extent as Obama captured the world’s attention and given its people hope for a better future,” the Nobel announcement in 2009 read.

The president, First Lady Michelle Obama and daughters Sasha and Malia began the day at St. John’s Episcopal church, which was built in 1812 and is known as the church of presidents. Obama later had coffee at the White House with congressional leaders, who play major roles in how the country is governed.

Monday’s events had less of the effervescence of four years ago, when the 1.8 million people packed into central Washington knew they were witnessing history. Obama is now older, grayer and more entrenched in the politics he once tried rise above. Officials said crowds were about half what they were four years ago.

Obama was expected to follow the recent tradition of walking at least part of the way back to the White House, surrounded by cheers.

As he enters his second term, Americans increasingly see Obama as a strong leader, someone who stands up for his beliefs and is able to get things done, according to a survey by the Pew Research Center for the People & the Press. The survey shows him with a 52 percent job approval rating, among the highest rankings since early in his presidency. His personal favorability, 59 percent, has rebounded from a low of 50 percent in the 2012 campaign against Republican Mitt Romney.

When the partying is done on Monday, it’s back to business for a president who is leading a nation that is, perhaps, as divided as at any time since the Civil War 150 years ago. That conflict put down a rebellion by southern states and ended slavery.

In light of the nation’s troubled racial history, Obama’s election to the White House in 2008 as the first black president was seen by many as a turning point. In his first inaugural address, Obama vowed to moderate the partisan anger engulfing the country, but the nation is only more divided four years on.

While Obama convincingly won a second term, the jubilation that surrounded him four years ago is subdued this time around — a reality for second-term presidents. He guided the country through many crushing challenges after taking office in 2009: ending the Iraq war, putting the Afghan war on a course toward U.S. withdrawal and saving the collapsing economy. He won approval for a sweeping health care overhaul.

Yet onerous problems remain, and his success in resolving them will define his place in history.