Massachusetts lawmakers have voted to eliminate term limits for state House speakers — a change pushed by Democratic Speaker Robert DeLeo, who supported term limits when he was first elected to the post in 2009.

The 109-45 vote Thursday was largely on party lines, with Republicans favoring term limits and most Democrats siding with DeLeo.

DeLeo defended his decision before the vote. He said his opinion has evolved since 2009.

Democratic supporters said without the change, DeLeo would be viewed as a lame duck during negotiations on Beacon Hill.

The earlier rule said no House member could be speaker for more than eight consecutive years.

DeLeo was elected speaker in 2009 and would have had to step down from the post in 2017 under the old rule.