Boston-based Fidelity looked at the 401(k) account performance for some 766,000 workers who continued to contribute to their accounts and remained invested from the end of 1999 through the end of 2009.

DES MOINES, Iowa — If you had money in the stock market over the past decade, you probably agree that it was one bumpy experience.

It might lead you to think your retirement account didn’t fare too well. A new study by Fidelity Investments shows consistent contributions and staying in the market paid off for many, but the gain was due more to a commitment to saving than stellar market performance.

Boston-based Fidelity looked at the 401(k) account performance for some 766,000 workers who continued to contribute to their accounts and remained invested from the end of 1999 through the end of 2009.

Their retirement account balances increased an average of 150 percent during the decade, climbing from $65,800 to $163,900.

However, 75 percent of that growth was attributed to the account holder adding new money and matching employer contributions. The remaining 25 percent came from market performance, said Michael Doshier, vice president of workplace investing for Fidelity.

The S&P 500 dropped 24 percent over the same time period. Comparisons between the 401(k) accounts and the S&P 500 index are imperfect, however, because the investments in 401(k) accounts are more widely diversified among stocks, bonds and cash investments.

Still, the results show that even when the markets are volatile, a 401(k) helps workers stick with a plan of saving even when market returns are anemic.

“A lot of people might have wavered, and some did, but those that didn’t and let the paycheck continue to plug away, really helped their return,” Doshier said.

Fidelity said among 11 million accounts it reviewed, the average 401(k) balance was up 28 percent in 2009, with the average balance at $64,200.