Dick’s Sporting Goods, one of the largest firearms retailers in the United States, is moving further away from selling guns, even as the shift takes a toll on its earnings.

On Tuesday, Dick’s said that it would strip firearms and other hunting products from 125 of its stores and replace the merchandise with batting cages, ski apparel and other sports gear. If the switch is successful, as it was at 10 stores where it was tested starting in the fall, it will be expanded, the company said.

The latest move to scale back gun sales is becoming a familiar one for the company and its chief executive, Edward Stack.

Last year, after 17 people were killed in a shooting in Parkland, Fla., Mr. Stack learned that the suspect, Nikolas Cruz, once bought a gun from Dick’s. That firearm was not used in the attack, but Mr. Stack realized it could have been.