Two of the nation’s leading gun sellers, Walmart and Dick’s Sporting Goods, took steps on Wednesday to limit their sales of firearms, thrusting themselves into the middle of the polarizing national debate over gun control.

Walmart, the biggest gun seller, announced late in the afternoon that it would not sell any gun to anyone under 21 years of age. It also said it would no longer sell items resembling assault-style rifles, including toys and air guns.

Early in the day, Dick’s said it was immediately ending sales of all assault-style rifles in its stores. The retailer also said that it would no longer sell high-capacity magazines and would also require any gun buyer to be at least 21, regardless of local laws.

Under federal law, a person must be at least 21 to buy a handgun from a firearms dealer. But 18-year-olds can buy semiautomatic rifles and other firearms.