Although President Obama said this week that the failure to persuade Congress to pass “common sense gun safety laws” was one of the great regrets of his presidency — just hours before the shooting in Louisiana — Congress is unlikely to close any of the loopholes in federal gun laws exposed by the recent shootings.

The bill in Congress with the most traction may be one that would give military officers the ability to carry weapons at recruitment centers.

Where Congress has faltered, the states have moved to tighten safety aspects of gun ownership. For instance, 10 states have made it harder for people with domestic violence convictions to obtain weapons.

Court records show that the gunman in Louisiana had a history of mental illness and had once been the subject of a protective order in Carroll County, Ga., which may have been detected with a stronger mental health reporting systems. That too is the subject of legislation languishing in Congress.

Nearly 20 states and the District of Columbia now have universal background check laws similar to a measure that failed in the last Congress, which may have blocked or at least slowed the gun purchase of Mohammod Youssuf Abdulazeez, who law enforcement officials say shot and killed four United States Marines and one sailor at a military recruitment center in Chattanooga. Mr. Abdulazeez bought his weapon on the Internet, an avenue that Senate legislation in the last Congress intended to make subject to background checks.

The man who the police say killed nine Charleston churchgoers had not completed his background check, but he was allowed to buy a gun anyway under a so-called default proceed. Federal law permits a firearms dealer who has initiated a background check to proceed with a sale if the dealer has not been notified of violations within three business days. Representative James E. Clyburn, Democrat of South Carolina, filed legislation that would close the loophole, but Republican leaders have not acted on it.