The gunman in the Texas church massacre was armed with a Ruger AR-556 -- a type of AR-15, the military-style rifle that has been used in many other recent mass shootings.

The AR-15 was designed for the U.S. military in the 1950s. (The inventor, Eugene Stoner, worked for a company called Armalite, which is where the AR comes from. The number 556 refers to the caliber: 5.56 millimeters, also referred to as .223-caliber.)

AR-15s purchased by civilians are usually semiautomatic, which means that one bullet is fired every time the trigger is pulled. The rifles are loaded with magazines, which are basically boxes of bullets that feed automatically into the gun as it is fired, until the magazine empties or the gun jams.

The capacity of the magazines varies, usually starting at 10 rounds, which is the legal limit in some states, but more often holding 30. Companies like TorkMag and X-Products make magazines or circular drums that can hold 50, and some magazines can hold even more than that.

The man identified by law enforcement sources as the gunman in Texas, Devin Patrick Kelley, bought the rifle from a sporting goods store in San Antonio in April 2016, a law enforcement official told CNN.

When Kelley filled out the background check paperwork at the store, he checked the box to indicate he didn't have any disqualifying criminal history, the official said.

Governor Greg Abbott said the gunman tried to get a license to carry in Texas but was denied.

Related: Why the AR-15 is the preferred weapon of mass shooters

Authorities have not said what capacity magazine he had. Fred Milanowski, the ATF special agent in charge, said two handguns were also recovered from the suspect's car.

AR-15s and similar military-style rifles like AK-47s are often referred to as assault rifles or assault weapons, though members of the gun industry prefer to call them modern sporting rifles, or MSRs. Ruger has a suggested retail price of $799 for the AR-556.

These guns were restricted by federal law for 10 years, until the so-called assault weapons ban expired in 2004. That ban restricted certain components of the gun, like the pistol grips and bayonet lugs, and limited magazine capacity to 10.

Certain states, including New York, California and Massachusetts, still impose restrictions that are similar to the expired federal ban.

AR-15-type rifles were used in the two deadliest mass shootings in modern American history -- the killing of 58 people from a window of the Mandalay Bay hotel in Las Vegas last month and the killing of 49 at a nightclub in Orlando, Florida, last year.

They were also used in the mass killings at Sandy Hook Elementary in Newtown, Connecticut, and a movie theater in Aurora, Colorado, both in 2012, and an office party in San Bernardino, California, in 2015.

Related: Bump stocks are selling briskly since Vegas attack

AR-15s are made by many different companies, including industry leaders like American Outdoor Brands (AOBC), which owns the Smith & Wesson line of M&P AR-15s, and also including Colt and Daniel Defense.

During the Obama administration, mass shootings often led to a surge in sales for AR-15s, because gun buyers feared the federal government would tighten gun control laws. But that didn't happen, and those fears were eased by the election of President Trump, who was endorsed by the NRA.

Gun retailers stockpiled AR-15s and other guns during the campaign, expecting Hillary Clinton to win. After Trump won, gun sales dropped, and sellers have lowered prices for AR-15s, which has hurt the manufacturers' bottom line.

What we know about church shooting suspect Devin Patrick Kelley

When Sturm, Ruger (RGR) reported a 35% plunge in quarterly sales last week, CEO Chris Killoy, told financial analysts that modern sporting rifles "got hit pretty heavily" this year. He called it a "soft sector" flooded with cheap rifles from off-brand competitors.

"MSRs are certainly an important part of our product line, but they're certainly not the dominant part of our product line by any means," he said. "We see that as a solid part of the market going forward, but it's still pretty bloody out there with the discounting from some of our competitors."

Ruger did not return messages on Monday from CNNMoney.

A version of the AR-15 known as the M-16 was first issued to U.S. soldiers and Marines in the Vietnam War, as America's answer to the AK-47, the rifle used by Soviet soldiers and the North Vietnamese.

Most U.S. soldiers now use a modern version known as the M4, though some soldiers use higher-priced AR-15s from companies like Daniel Defense.

AR-15s used by soldiers typically have a fully automatic setting as well as semiautomatic. This allows the gun to fire a continuous stream of bullets for as long as the trigger is pulled and held, until the gun runs out of bullets or jams.

Sometimes these military rifles have an auto-burst or double-tap setting as well, which allows more than one shot to be fired with a single trigger pull. Short bursts are considered more accurate than fully automatic, when aim becomes difficult to control.

It is possible for civilians to legally own fully automatic weapons, but it is difficult and expensive, given the extra layers of gun control. So most of the AR-15s owned by civilians are semiautomatic.