Retail giant Dick’s Sporting Goods announced Wednesday that it will no longer sell assault-style rifles, as well as any guns to anyone under age 21 in the wake of the Florida school massacre.

Dick’s CEO Ed Stack said the company discovered shortly after Nikolas Cruz’s identity became known that it had legally sold a gun to him in November — though it was not the gun or type of gun used in the massacre.

“But it came to us that we could have been a part of this story,’’ he told The New York Times. “We said, ‘We don’t want to be a part of this any longer.’”

The prominent gun seller also said it would no longer sell high-capacity magazines.

Stack said the current systems in place are not effective enough to prevent gun sales to people who may pose threats and urged Congress to act.

The announcement come two weeks after the shooting at Parkland’s Marjory Stoneman Douglas High School, where 17 people were slaughtered with an AR-15.

“When we saw what happened in Parkland, we were so disturbed and upset,” Stack, 63, told The New York Times. “We love these kids and their rallying cry: ‘Enough is enough!’ It got to us.”

Stack, whose father founded the store in 1948, added: “We’re going to take a stand and step up and tell people our view and, hopefully, bring people along into the conversation.”

Several major companies – including Hertz car rental, MetLife insurance and Delta Air Lines – have severed their ties with the National Rifle Association in the wake of the shooting.

Dick’s is calling on politicians to enact what it calls “common sense gun reform’’ by passing laws to raise the minimum age to buy guns to 21, to ban assault-type weapons and so-called bump stocks, and to conduct tighter background checks.

The retailer said all AR-15s and other semiautomatic rifles would be removed from its stores and websites.

Stack said the company remains a strong backer of the Second Amendment and will continue to sell a variety of sport and hunting firearms.

Although he has never been a member of the NRA, Stack told the paper that he is a gun owner and enjoys trapshooting clay targets.

Dick’s also responded to the 2012 school massacre at Sandy Hook Elementary School in Connecticut by yanking assault-style rifles from its main retail stores.

But a few months later, it began carrying the firearms at its outdoor and hunting retail chain, Field & Stream.

This time, however, the changes will be permanent, said Stack, who expected a mixed response to the new policy.

“The whole hunting business is an important part of our business, and we know there is going to be backlash on this — but we’re willing to accept that,” he told the paper.

“If the kids in Parkland are being brave enough to stand up and do this, we can be brave enough to stand up with them.”