SEATTLE — The Legislature had the right to eliminate state employee pension increases that were approved during the stock market boom of the 1990s, the Washington Supreme Court said unanimously Thursday in two decisions that save the state billions of dollars but leave many public employees feeling cheated.In twin rulings on identical legal issues, the court found that lawmakers were within their rights in 2007 when they repealed a “gain-sharing” benefit that paid employees more when investment returns on pension trust funds exceeded expectations, and in 2011 when they repealed automatic cost-of-living adjustments for certain retirees.In each case, the Legislature had reserved the right to eliminate the benefits in the future, the court said. Both decisions reversed lower-court rulings.“I don’t think having to take away these benefits was something anyone enjoyed,” said Sen. Barbara Bailey, an Oak Harbor Republican who chairs the Legislature’s Select Committee on Pension Policy. “But had we not done this, or had it not been upheld, the cost to the state would have been in the billions.”Public-sector unions and others who sought to maintain the benefits did not dispute their cost. But, they argued, the state had dangled the promise of the pension enhancements in the late ’90s when officials persuaded tens of thousands of workers to give up their costly defined-benefit retirement plans for cheaper plans. The cheaper plans reduced the defined benefits by half while adding a mix of defined contributions and gain-sharing, which occurred when investment returns exceeded 10 percent for four straight years.