Mass shooters from Aurora, Colorado, to Orlando, Florida, have sometimes obtained guns by exploiting limited weapons laws and blind spots in the background-check process.
The shooters at Sandy Hook Elementary School and San Bernardino, California, used weapons purchased by others, shielding them from background checks. In other attacks, the gunmen legally bought arms on their own.
In the absence of congressional action, President Barack Obama has tried to close loopholes and expand gun-control measures on his own, all while acknowledging, "We maybe can't save everybody, but we could save some."
Obama's executive action in the wake of last year's San Bernardino attack expanded mandatory background checks to gun shows, flea markets and online sales. But none of those measures would have kept weapons out of the hands of suspects in other recent mass shootings.
In Aurora and at the Navy Yard in Washington, D.C., men undergoing mental health treatment were cleared to purchase weapons because federal background checks look for criminal histories and court-ordered commitments for signs of mental illness.
The Obama administration is also seeking to add certain Social Security Administration data to the background-check system and to help states report more information about people who are barred from gun possession for mental health reasons.
A look at recent mass shootings and how the attackers obtained their guns:
ORLANDO, FLORIDA: 49 PEOPLE KILLED ON JUNE 12, 2016
Omar Mateen purchased an AR-15 rifle and a handgun on separate days about a week before the attack from a federally licensed dealer near his home in Fort Pierce, Florida. The 29-year-old passed a full background check and had two security licenses, one of which allowed him to be armed while on duty, according to Ed Henson, owner of the St. Lucie Shooting Center.
The FBI investigated Mateen in 2013 and 2014 after co-workers shared concerns about statements he had made concerning possible ties to terrorist groups. Neither inquiry led to criminal charges. Even if he had been placed on a terrorism watch list, Congress last year rejected attempts to prevent people on the list from purchasing guns.
KALAMAZOO, MICHIGAN: SIX PEOPLE KILLED ON FEB. 20, 2016
Jason Brian Dalton used two legally purchased 9mm semi-automatic handguns in the killings of two people at a Kia car dealership and four people outside a Cracker Barrel restaurant. Police said the 45-year-old Uber driver bought the weapons at a local gun shop in 2015 and had no disqualifying criminal or mental health history. It's unclear how Dalton obtained 14 other guns federal agents seized from his home.
SAN BERNARDINO, CALIFORNIA: 14 PEOPLE KILLED ON DEC. 2, 2015
Syed Farook and his wife used weapons that the FBI said were legally purchased by his neighbor, Enrique Marquez, from a licensed dealer in 2011 and 2012. Marquez, now facing conspiracy and other charges, told investigators that Farook asked him to buy the weapons because he would draw less attention. At the time, the FBI said, the men were plotting to shoot up a community college and a highway.
ROSEBURG, OREGON: 10 PEOPLE KILLED ON OCT. 1, 2015
Christopher Harper-Mercer and his family members legally purchased the handguns and rifle he used in the Umpqua Community College shooting from a federally licensed gun dealer, according to the Bureau of Alcohol, Tobacco, Firearms and Explosives.
CHATTANOOGA, TENNESSEE: FIVE PEOPLE KILLED ON JULY 16, 2015
Some of the weapons Muhammad Youssef Abdulazeez used in his attack on a pair of military facilities were purchased legally and some were not, according to the FBI. It is unclear when the purchases were made and whether he was subject to a background check. Relatives said Abdulazeez had a history of mental illness and had been arrested recently on suspicion of driving under the influence of alcohol. In May 2013, he failed a background check for an engineering job at a nuclear power plant in Ohio.
CHARLESTON, SOUTH CAROLINA: NINE PEOPLE KILLED ON JUNE 17, 2015
A drug arrest should have prevented Dylann Roof from purchasing the pistol authorities said he used at Emanuel AME Church, but a record-keeping error and background check delay allowed the transaction to go through. The FBI said a background check examiner never saw the arrest report because the wrong arresting agency was listed in state criminal history records. After three days, the gun dealer was legally permitted to complete the transaction.
WASHINGTON, D.C.: TWELVE PEOPLE KILLED ON SEPT. 16, 2013
Aaron Alexis, a former reservist turned civilian contractor, passed state and federal background checks and legally purchased the pump-action shotgun used in the Washington Navy Yard shooting despite a history of violent outbursts and recent mental health treatment. Alexis was accused of firing a gun in anger in Texas in 2004 and in Seattle in 2010, but was not prosecuted in either case. In 2011, he received an honorable discharge despite bouts of insubordination, disorderly conduct and unauthorized absences. None of that would have disqualified him from purchasing a weapon.
NEWTOWN, CONNECTICUT: 26 PEOPLE KILLED ON DEC. 14, 2012
Adam Lanza used his mother's weapons, including a .223-caliber semi-automatic rifle, in the massacre at Sandy Hook Elementary School. Lanza's mother, whom he fatally shot before going to the school, also purchased the ammunition, investigators said.
AURORA, COLORADO: 12 PEOPLE KILLED ON JULY 20, 2012
James Holmes was receiving psychiatric treatment when he passed required federal background checks and legally purchased the weapons he used in the movie theater assault. As in the Navy Yard case, Holmes' treatment alone did not prevent him from buying guns. The purchases would have been blocked only if he had been legally declared a "mental defective" or committed to a mental institution.