Cheering Democrats returned Nancy Pelosi to the House speaker's post Thursday as the 116th Congress took office and ushered in a historically diverse class of freshmen ready to confront President Donald Trump in a new era of divided government.

Trump congratulated Pelosi during a rare appearance in the White House briefing room.

The president, who has tangled with Pelosi and is sure to do so again, called her election by House colleagues "a tremendous, tremendous achievement."

Pelosi, elected speaker 220-192, took the gavel saying U.S. voters "demanded a new dawn" in the November election and are looking to "the beauty of our Constitution" to provide checks and balances on power. She invited scores of lawmakers' kids to join her on the dais as she was sworn in, calling the House to order "on behalf of all of America's children." She faced 15 dissenting votes from fellow Democrats.

The new Congress is like none other. There are more women than ever before, and a new generation of Muslims, Latinos, Native Americans and African-Americans in the House is creating what academics call a reflective democracy, more aligned with the population of the United States. The Republican side in the House is still made up mostly of white men, and in the Senate Republicans bolstered their ranks in the majority.

In a nod to the moment, Pelosi, the first female speaker, was broadly pledging to make Congress work for all Americans — addressing kitchen table issues at a time of deep economic churn — even as her party is ready to challenge Trump with investigations and subpoena powers that threaten the White House agenda. It's the first new Congress to convene amid a partial government shutdown, now in its 13th day over Trump's demands for money for a wall along the U.S-Mexico border.

The House will be "for the people," Pelosi said. She promised to "restore integrity to government" and outlined an agenda "to lower health costs and prescription drugs prices, and protect people with pre-existing medical conditions; to increase paychecks by rebuilding America with green and modern infrastructure from sea to shining sea."

The day was unfolding as one of both celebration and impatience. Newly elected lawmakers arrived, often with friends and families in tow, to take the oath of office and pose for ceremonial photos. The Democrats promised quick passage of legislation to re-open the government, but without the funding Trump is demanding for his promised border wall.

Vice President Mike Pence swore in newly-elected senators, but Senate Republicans under Majority Leader Mitch McConnell had no plans to consider the House bills to fund the government unless Trump agrees to sign them into law. That ensures the shutdown will continue, clouding the first days of the new session.

McConnell said that Republicans have shown the Senate is "fertile soil for big, bipartisan accomplishments," but that the question is whether House Democrats will engage in "good governance or political performance art."

It's a time of stark national political division that some analysts say is on par with the Civil War era. Battle lines are drawn not just between Democrats and Republicans but within the parties themselves, splintered by their left and right flanks.

Pelosi defied history in returning to the speaker's office after eight years in the minority, overcoming internal opposition from Democrats demanding a new generation of leaders. She will be the first to regain the gavel since legendary Sam Rayburn of Texas in 1955.

Putting Pelosi's name forward for nomination, Rep. Hakeem Jeffries of New York, the incoming Democratic caucus chair, recounted her previous accomplishments -- passing the Affordable Care Act, helping the country out of the Great Recession -- as preludes to her next ones. He called her leadership "unparalleled in modern American history."

One Democrat, Rep. Brenda Lawrence of Michigan, cast her vote for Pelosi "on the shoulders of women who marched 100 years ago" for women's suffrage. Newly elected Rep. Lucy McBath of Georgia, an anti-gun violence advocate, dedicated hers to her slain teenage son, Jordan Davis.

As speaker, Pelosi will face an early challenge from the party's robust wing of liberal newcomers, including 29-year-old New Yorker Alexandria Ocasio-Cortez, who has risen to such prominence she is already known around the Capitol — and on her prolific social media accounts — by the nickname "AOC." She said she'd cast a no vote on a new package of rules to govern the House.

Ocasio-Cortez and other liberals oppose the pay-as-you-go budget provisions in the rules package that would allow restrictive objections to any legislation that would add to federal deficits. They say such restraints would hamstring Democratic efforts to invest in health care, education and develop a Green New Deal of renewable energy infrastructure projects to fight climate change.

Republicans face their own internal battles beyond just the conservative House Freedom Caucus, but as they decide how closely to tie their political fortunes to Trump. GOP leader Kevin McCarthy's name was put into nomination by his party's caucus chair, Rep. Liz Cheney of Wyoming, the daughter of the former vice president. He faced six "no" votes from his now-shrunken GOP minority.

McCarthy told the lawmakers that voters often wonder if Congress is "still capable" of solving problems, and as he passed the gavel to Pelosi he said this period of divided government is "no excuse for gridlock."

One office remains disputed as the House refused to seat Republican Mark Harris of North Carolina amid an investigation by state election officials of irregularities in absentee ballots from the November election.

Many GOP senators are up for re-election in 2020 in states, including Colorado and Maine, where voters have mixed views of Trump's performance in the White House.

Trump, whose own bid for 2020 already is underway, faces potential challenges from the ranks of Senate Democrats under Chuck Schumer. Trump had little to say early Thursday as the new Congress was convening, but he did tweet an attack on one of his likely presidential challengers, Sen. Elizabeth Warren of Massachusetts, mocking her claim to Native American ancestry.

The halls of the Capitol were bustling with arrivals, children in the arms of many new lawmakers. Visitor galleries included crooner Tony Bennett and rock legend Mickey Hart, both guests of Pelosi. Incoming White House Chief of Staff Mick Mulvaney, a former congressman, sat with Republican leaders.

Rep. Emanuel Cleaver, D-Mo., opened the House prayer asking at "a time fraught with tribalism at home and turbulence abroad" that lawmakers "become the architects of a kindlier nation."

Overnight, Democratic Rep-elect Ilhan Omar of Minnesota tweeted a picture with her family at the airport. The House rules were being changed to allow her to wear a head scarf on the chamber floor. She wrote, "23 years ago, from a refugee camp in Kenya, my father and I arrived at an airport in Washington DC. Today, we return to that same airport on the eve of my swearing in as the first Somali-American in Congress."

___

Associated Press writers Matthew Daly, Alan Fram, Kevin Freking, Mary Clare Jalonick and Laurie Kellman contributed to this report.

Follow on Twitter at https://twitter.com/lisamascaro