WASHINGTON (AP) — Rep. Nancy Pelosi all but ensured Wednesday that she will become House speaker next month, quelling a revolt by disgruntled younger Democrats by agreeing to limit her tenure to no more than four additional years in the chamber’s top post.

Within moments of announcing she would restrict her time in the job, seven of her critics distributed a statement promising to back the California Democrat. Democrats widely agreed that the pledge meant Pelosi had clinched a comeback to the post she held from 2007 until January 2011, the last time her party ran the House and the first time the speaker was a woman.

ADVERTISEMENT

Wednesday’s accord gives Pelosi a clear path to becoming the most powerful Democrat in government and a leading role in confronting President Donald Trump during the upcoming 2020 presidential and congressional campaigns. It moves a 78-year-old white woman to the cusp of steering next year’s diverse crop of House Democrats, with its large number of female, minority and younger members.

The agreement also ends what’s been a distracting, harsh leadership fight among Democrats that has been waged since Election Day, when they gained at least 39 seats and grabbed House control for the next Congress. It was their biggest gain of House seats since the 1974 post-Watergate election.

Democrats have been hoping to train public attention on their 2019 agenda focusing on health care, jobs and wages, and building infrastructure projects. They also envision investigations of Trump, his 2016 presidential campaign and his administration.

To line up support, Pelosi initially resorted to full-court lobbying by congressional allies, outside Democratic luminaries, and liberal and labor organizations. She cut deals with individual lawmakers for committee assignments and roles leading legislative efforts.

But in the end, she had to make concessions about her tenure to make sure she’ll win a majority — likely 218 votes — when the new House convenes Jan. 3. Democrats are likely to have 235 seats, meaning she could spare only 17 defections and still prevail if, as expected, Republicans all oppose her.

Pelosi had described herself as a transitional leader over the last several weeks. But she’d resisted defining how long she would serve as speaker, saying it would lessen her negotiating leverage to declare herself a lame duck.

ADVERTISEMENT

On Wednesday, she gave in to her opponents’ demands that she limit her service. Under the deal, House Democrats will vote by Feb. 15 to change party rules to limit their top three leaders to no more than four two-year terms, including time they’ve already spent in those jobs.

“I am comfortable with the proposal and it is my intention to abide by it whether it passes or not,” Pelosi said in her statement.

Pelosi’s opponents have argued it was time for younger leaders to command the party. They also said her demonization as an out-of-touch radical in tens of millions of dollars’ worth of Republican television ads was costing Democrats seats.

While some Democrats are still certain to vote against Pelosi — especially incoming freshmen who promised to do so during their campaigns — most Democrats have remained solidly behind her. She’s been a strong fundraiser and unrelenting liberal who doesn’t shy from political combat, and her backers complained that her opponents were mostly white men who were largely more moderate than most House Democrats.

Pressure to back Pelosi seemed to grow after she calmly went toe-to-toe with Trump at a nationally televised verbal brawl in the Oval Office on Tuesday over his demands for congressional approval of $5 billion for his proposed border wall with Mexico.

“We are proud that our agreement will make lasting institutional change that will strengthen our caucus and will help develop the next generation of Democratic leaders,” the rebellious lawmakers said in a written statement.

To be nominated to a fourth term under the agreement, Pelosi would need to garner a two-thirds majority of House Democrats. Several aides said they believed restlessness by younger members to move up in leadership would make that difficult for her to achieve.

The limits would also apply to Pelosi’s top lieutenants, No. 2 leader Steny Hoyer of Maryland and No. 3 leader James Clyburn of South Carolina. Both are also in their late 70s.

Rep. Ed Perlmutter, D-Colo., was among 16 Democrats who had signed a letter demanding new leadership but who ultimately helped negotiate the deal with Pelosi.

Joining Perlmutter in saying they would now back her were Democratic Reps. Seth Moulton of Massachusetts; Tim Ryan of Ohio; Bill Foster of Illinois; Linda Sanchez and Rep.-elect Gil Cisernos, both of California; and Filemon Vela of Texas.