WASHINGTON (AP) — The 117th Congress opened with the unfathomable Jan. 6, 2021, mob siege of the Capitol and is closing with unprecedented federal criminal referrals of the former president over the insurrection — all while conducting one of the most consequential legislative sessions in recent memory.

Lawmakers are wrapping up the two-year session having found surprisingly common ground on big bills, despite enduring bitter political divisions that haunt the halls, and the country, after the bloody Capitol attack by supporters of the defeated president, Donald Trump, that threatened democracy.

The Congress passed monumental legislation — including a bill making one of the most substantial infrastructure investments in a generation and another federally protecting same-sex and interracial marriages. It rallied the U.S. to support Ukraine in the war against Russia. Senators confirmed the nation’s first Black woman, Justice Ketanji Brown Jackson, to the Supreme Court.

Among the rare moments of agreement: passage of the Emmett Till Anti-Lynching Act, making lynching a federal hate crime, after more than 120 years and some 200 failed efforts to pass such legislation.

In many ways, the chaos of the Capitol attack created a new coalition in Congress — lawmakers who want to show America can govern. With President Joe Biden in the White House, the Democrats who controlled Washington found new partners in a wing of the Republican Party eager to push past the Trump years and the former president’s repeated lies about a stolen election that led to the Capitol siege.

Senate Majority Leader Chuck Schumer, D-N.Y., compared this session to the Lyndon Johnson and Franklin Roosevelt administrations that produced some of the nation’s most lasting laws.

“These two years in the Senate and House — in the Congress — were either the most productive in 50 years Great Society, or most productive in 100 years since the New Deal,” he said.

And yet the legislative session that kicked off with the historic second impeachment of Trump for inciting the insurrection ended its final days with deeply felt partisanship.

Republican leader Kevin McCarthy unleashed a dark and vitriolic attack on colleagues Friday ahead of voting on the $1.7 trillion spending bill to keep government running another year.

“One of the most shameful acts I’ve ever seen,” McCarthy said, as many members voted by proxy.

McCarthy, who is struggling to take over as House speaker in the new year when Republicans have control, lashed out at the two retiring senators, a Democrat and a Republican, who partnered with House Democrats to craft the bill. He named names.

“I feel sad for you,” McCarthy said, “but more importantly, the damage you’ve done to America.”

Speaker Nancy Pelosi, in what was likely her last speech as Democratic leader, delivered bright holiday wishes and a cutting response.

“It was sad to hear the minority leader earlier say that this legislation is ‘the most shameful’ thing to be seen on the House floor in this Congress. I can’t help but wonder had he forgotten January 6?”

Congress and the country have confronted one of the more divisive eras in American politics, partisan chasms scholars say unlike any seen since the middle of the 19th century, around the time of the Civil War.

Democrats had control these past two years, but just barely. The Senate was evenly split this session, 50-50, for the longest period in modern memory. The House’s slim margin will be similar in the next session, but in Republican rather than Democratic control after the midterm elections.

Yet, as the branch of the federal government closest to the people, the Congress found its way to carry on, despite COVID-19 pandemic restrictions that kept the Capitol partly closed and menacing security threats to lawmakers. Pelosi’s husband was brutally attacked in their home by an assailant who said he was intent on breaking the speaker’s kneecaps.

Together, lawmakers sent Biden the $1 trillion bipartisan infrastructure bill that invested in the nation’s roads, bridges and public works, and another big package to invest in semi-conductor industry and scientific research in the U.S.

Democrats alone approved a massive coronavirus aid package that put money in Americans’ pockets, supported business and funded free vaccines, a $1.9 trillion deal Republicans rejected as wasteful spending and blamed for fueling soaring inflation.

While Biden’s promised “Build Back Better” fell apart, his party regrouped to pass the Inflation Reduction Act, which that may not have curbed rising prices but delivered the nation’s biggest investment yet in efforts to curb climate change and capped monthly insulin prices for seniors at $35 starting in January.

The first bill to curb gun violence, though modest compared to advocates’ demands, became law after the tragic school shooting in Uvalde, Texas — nearly a full decade after the Sandy Hook school shooting that killed 20 children failed at the time to move lawmakers to act.

As the worst war in Europe since World War II broke out, Congress embraced a little-known leader, welcoming Ukrainian President Volodymyr Zelenskyy twice — first to address lawmakers remotely at the start of Russia’s invasion and with a daring in-person speech this past week that echoed Winston Churchill’s 1941 visit to Congress.

The latest $45 billion tranche of Ukrainian aid could very well be the last for now, once Republicans who oppose the overseas spending take control in the new year as the focus puts a priority on America’s needs at home.

And after an 18-month investigation into attack on the Capitol, the panel formed by Pelosi after Congress failed to stand up an independent commission released its 814-page report finding “one man” was responsible for the mob siege. Trump summoned the crowd to Washington and urged supporters to “fight like hell” for his presidency as Congress was meeting to certify Biden’s election.

Jan. 6 committee Chairman Bennie Thompson, D-Miss., said the report provides a “roadmap to justice” and the panel took the unprecedented step of referring the former president for prosecution.

Among the committee’s 11 recommendations to shore up democracy, Congress took a first step by passing the Electoral Count Act to bolster the way Congress tallies the presidential vote.

Past sessions of Congress have produced big bills: Republicans approved the $2 trillion tax cuts package with Trump’s signature in 2017; Democrats ushered the Affordable Care Act to law with Barack Obama in 2010.

While Schumer said he wants to work again with Republican leader Mitch McConnell for more bipartisan bills in the new year, the House GOP leader has other plans.

“In 11 days this all changes,” McCarthy said Friday. “The new direction is coming.”