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 powerful post.

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 earlier Thursday, speaking with reporters after emerging from a closed-door caucus with Democratic lawmakers.

DeLeo said he didn't feel he was going back on his word, pointing to the experience he's gained as speaker. The earlier rule that was backed by DeLeo in 2009 limited speakers to four, two-year terms.

Under that rule, DeLeo, elected speaker in 2009, would have to step down in 2017. The change allows the Winthrop Democrat to remain speaker as long as House members continue to elect him.

"From six years in 2009 to hence my opinion has evolved," DeLeo said. "I wouldn't say I'm going back on my word as much as the fact that over six years, rightly or wrongly, I have learned ... in terms of what the importance is of doing away with the term limits that we have in our rules."

Democratic supporters of the change said the term limits puts DeLeo at a disadvantage during negotiations with newly elected Republican Gov. Charlie Baker and new Senate President Stanley Rosenberg, an Amherst Democrat, where he could be seen as a lame duck.

Baker steered clear of the debate.

"I'm a big believer in letting the House and the Senate make their own decisions with respect with how they want to manage their affairs and they'll make whatever decision they think makes sense for them," Baker said Thursday.

The group Common Cause Massachusetts also opposed the change.

It issued a statement Wednesday arguing in favor of term limits, saying they serve an important function, given that speakers aren't subject to statewide election. They said without term limits, a speaker must either be deposed, be forced out due to ethical problems or leave of their own will, typically after hand-picking a successor.

DeLeo asked lawmakers in 2009 to reinstitute the eight-year term limit to restore public trust in state government after Democratic predecessors Thomas Finneran and Salvatore DiMasi left the speaker's office under an ethics cloud.

At the time, DeLeo told The Boston Globe that his proposal to limit the terms of House speakers was largely symbolic, since speakers rarely serve more than eight years.

Massachusetts has a recent history of former speakers running into criminal or ethical trouble.

DiMasi was sentenced in 2011 to eight years in federal prison for using his influence to steer $17.5 million in state contracts to a software firm in exchange for kickbacks.

Finneran, who preceded DiMasi as speaker, was indicted after leaving office for lying during his testimony in a redistricting lawsuit. He eventually pleaded guilty to obstruction of justice.

The speaker who preceded Finneran - fellow Democrat Charles Flaherty - also was forced from office after pleading guilty to a federal felony tax charge.