Nancy Pelosi has all but ensured that she will be elected House speaker in January by agreeing to limit how long she would serve in the post to no more than four additional years.

The California Democrat said in a written statement on Wednesday that she is “comfortable” with the plan.

Moments after she released her statement, seven rebellious Democrats said they would now back her for the post that would put her second in line to the presidency after vice-president Mike Pence.

Nancy Pelosi (left) will be behind Vice President Mike Pence (centre) in the line of succession to Donald Trump when she is confirmed as House speaker (Evan Vucci/AP)

That essentially guaranteed she will be elected speaker when the full House votes for its leader on January 3.

A small group of unhappy Democrats, potentially enough to thwart her drive to win the job, had been threatening to vote against the 78-year-old unless she agreed to limit her service.

The group wants the party’s ageing leaders to step aside for a new generation.

The Democrats regained control of the lower house in midterm elections that gave a mixed verdict on Donald Trump’s presidency, with Republicans consolidating their grip on the Senate and keeping some key state governorships.