Rep. Nancy Pelosi (D-CA) has nearly crushed an insurgent Democrat rebellion against her with a new deal on Wednesday that would limit her time as speaker to a maximum of four years.

Pelosi struck a deal with recalcitrant Democrats on Wednesday that would term limit her time as Speaker of the House to four years maximum, or two congressional terms. This is retroactive, meaning that Pelosi can only serve through 2022.

In return, several Democrats who opposed her will support her during her crucial January 3 House floor vote to make her the next leader of the House.

Pelosi’s deal would also term limit her two deputies, Steny Hoyer (D-MD), who currently serves as House Minority Whip, and Jim Clyburn (D-SC).

“Over the summer, I made it clear that I see myself as a bridge to the next generation of leaders, a recognition of my continuing responsibility to mentor and advance new Members into positions of power and responsibility in the House Democratic Caucus,” Pelosi said in a statement on Wednesday, revealing the deal.

The former Speaker of the House spent the last several weeks lobbying reluctant Democrats as she tried to secure enough votes for the House’s top post.

Afterwards, several Democrats announced in a joint statement that they support Pelosi for Speaker. The recalcitrant Democrats wrote:

We wish to thank Nancy Pelosi for her willingness to work with us to reach this agreement. 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. We will support and vote for Nancy Pelosi for Speaker of the House in the 116th Congress.

The recalcitrant Democrats include Reps. Ed Perlmutter (D-CO), Linda Sanchez (D-CA), Filemon Vela (D-TX), Tim Ryan (D-OH), Seth Moulton (D-MA), as well as Rep.-elect Gil Cisneros (D-CA).

Cisneros appears to have flip-flopped, as he promised throughout most of his campaign to vote against Pelosi for Speaker. In a statement in June, Cisneros said, “it’s time for new leadership.”

National Republican Congressional Committee spokesman Jack Pandol said in a statement on Thursday, “Gil Cisneros is a fraud. If Gil will betray the voters on the first major decision he makes in Washington, how can they trust him at all?”