WASHINGTON (AP) — House Speaker Nancy Pelosi said Thursday that she will not seek a leadership position in the new Congress, a pivotal realignment making way for a new generation of leaders after Democrats lost control of the House to Republicans in the midterm elections.

Pelosi announced in a spirited speech on the House floor that she will step aside after leading Democrats for nearly 20 years and in the aftermath of the brutal attack on her husband, Paul, last month in their San Francisco home.

The California Democrat, who rose to become the nation’s first woman to wield the speaker’s gavel, said she would remain in Congress as the representative from San Francisco, a position she has held for 35 years, when the new Congress convenes in January.

“Now we must move boldly into the future,” Pelosi said. “The hour has come for a new generation.”

It’s an unusual choice for a party leader to stay on after withdrawing from congressional leadership but one befitting of Pelosi, who has long defied convention in pursuing power in Washington.

Pelosi noted in a statement after The Associated Press called control of the chamber that, in the next Congress, House Democrats will have “strong leverage over a scant Republican majority.”

Democrats cheered Pelosi as she arrived in the chamber at noon. On short notice, lawmakers filled the House, at least on the Democratic side, and Senate Majority Leader Chuck Schumer joined. The Speaker’s Gallery filled with Pelosi staff and guest. Some Republicans, including some newly-elected members, also attended.

The first women to become speaker, and the only person in decades to be twice elected to the role, she has led Democrats through consequential moments, including passage of the Affordable Care Act with President Barack Obama and the impeachments of President Donald Trump.

By announcing her decision, Pelosi could launch a domino effect in House Democratic leadership ahead of internal party elections next month as Democrats reorganize as the minority party for the new Congress.

Pelosi’s leadership team, with Majority Leader Steny Hoyer of Maryland and Democratic Whip James Clyburn of South Carolina, has long moved as a triumvirate. Hoyer and Clyburn are also making decisions about their futures.

All now in their 80s, the three House Democratic leaders have faced restless colleagues eager for them to step aside and allow a new generation to take charge.

Democratic Reps. Hakeem Jeffries of New York, Katherine Clark of Massachusetts and Pete Aguilar of California have similarly moved as a trio, all working toward becoming the next generation of leaders. Jeffries could make history if he enters the race to become the nation’s first Black speaker of the House.

One idea circulating on Capitol Hill was that Pelosi and the others could emerge as emeritus leaders as they pass the baton to new Democrats.

Clyburn, the highest-ranking Black American in Congress, has said he has no interest in being speaker or leader of the minority at this point in his life but expects to stay in Congress next year.

“I do wish to remain at the leadership table,” Clyburn said a week after the midterms. “As to what capacity that will be, I will leave that up to our Democratic caucus.”

Hoyer has not spoken publicly of his plans.

First elected in 1987, Pelosi has been a pivotal figure in American politics, long ridiculed by Republicans as a San Francisco liberal while steadily rising as a skilled legislator and fundraising powerhouse. Her own Democratic colleagues have intermittently appreciated but also feared her powerful brand of leadership.

Pelosi first became speaker in 2007, saying she had cracked the “marble ceiling,” after Democrats swept to power in the 2006 midterm elections in a backlash to then-President George W. Bush and the wars in Iraq and Afghanistan.

When she was poised in 2018 to return as speaker, in the Trump era, she vowed “to show the power of the gavel.”

Pelosi has repeatedly withstood leadership challenges over the years and had suggested in 2018 she would serve four more years as leader. But she had not discussed those plans more recently.

Typically unsentimental, Pelosi let show a rare moment of emotion on the eve of the midterm elections as she held back tears discussing the grave assault on her husband of nearly 60 years.

Paul Pelosi suffered a fractured skull after an intruder broke into their home in the middle the night seeking the Democratic leader. The intruder’s question — “Where is Nancy?” — echoed the chants of the pro-Trump rioters at the Capitol on Jan. 6, 2021, as they hunted for Pelosi and tried to stop Congress from certifying Joe Biden’s election victory over Trump.

David DePape is being held without bail on attempted murder and other charges in what authorities said was a political attack. Police said DePape broke in and woke up Paul Pelosi, and the two struggled over a hammer before DePape struck the 82-year-old on the head. DePape, 42, has pleaded not guilty to federal charges of attempting to kidnap a federal official and assaulting a federal official’s family member.

Paul Pelosi was hospitalized for a week but is expected to recover, though his wife has said it will be a long haul.

At the time, Speaker Pelosi would not discuss her political plans but would only disclose that the attack on her husband would impact her decision.

Historians have noted that other consequential political figures had careers as rank-and-file members of Congress, including John Quincy Adams, the former president, who went on to serve for nearly 18 years in Congress.

Associated Press staff writers Kevin Freking and Farnoush Amiri contributed to this report.