The rifles were variants of the popular AR-15, the semiautomatic civilian version of a military M-16. They are surprisingly easy to acquire in California, though they come with limitations aimed at curbing their ability to inflict mass damage. Semiautomatic rifles, for instance, cannot have magazines that hold more than 10 bullets or can be quickly removed.

However, such limitations can be easily, if illegally, bypassed. For instance, a 10-bullet magazine can be quickly removed by pressing the tip of a loose bullet into a recessed button, allowing for a high-capacity magazine to be inserted in its place.

This release feature — called a “bullet button” — is installed, legally, by gun manufacturers on rifles sold in California; the high-capacity magazine is illegal in the state.

Other restricted features, like pistol grips and folding stocks — which allow greater control of the weapon while firing for a long period of time — can also be added to some guns after their sale.

The police in San Bernardino said Thursday that the husband-and-wife suspects, Syed Rizwan Farook and Tashfeen Malik, had at least four high-capacity magazines and more than a thousand rounds of ammunition. Law enforcement specialists who briefed congressional officials on Thursday said that Mr. Farook bought two pistols legally and that another person bought the two .223-caliber rifles — a DPMS A-15 and Smith & Wesson M&P15 — legally.

The weapons were purchased in 2011 and 2012, but the briefers did not specify which were bought when. It is not clear how those two guns ended up with the couple, and whether the seller complied with laws requiring that gun purchases go through a licensed dealer to ensure a background check is conducted.

Despite California’s relatively tough gun laws, it is not difficult to legally buy semiautomatic rifles that critics call assault weapons but are marketed by gun makers as “modern sporting rifles.” C.D. Michel, a Long Beach lawyer who has brought numerous legal challenges against gun ownership restrictions, said that “none of these laws have proven to be effective.”

“There’s a substitution effect,” said Mr. Michel, who counts among his clients the National Rifle Association. “If you ban Rifle X, people will use Rifle Y. When you strip away the prohibited features, you have a bare rifle, if you will, that is not necessarily a banned assault weapon.”

Go online, and it is not hard to find semiautomatic AR-15-style rifles offered for sale as “California compliant.” This is despite a series of laws dating to 1989 that banned a number of specific brands, as well as certain generic features.

Also, Californians can still legally possess assault rifles that they owned before the prohibitions went into effect as long as they have registered them with the state. More than 100,000 such weapons are registered.

The ban on high-capacity magazines, as well as the requirement that a magazine be affixed to the gun, was meant to prevent firing dozens of rounds from a single magazine and then quickly reloading, as has happened in many mass shooting cases. The development of the bullet button took advantage of a provision in California law allowing the sale of a gun with a magazine that could be removed with a “tool,” rather than simply by pressing a release-catch with a finger.

A bullet, for this purpose, is considered “a tool” because it can be pushed into the recessed button created by gun manufacturers in order to continue selling semiautomatic rifles legally in California, said Lindsay Nichols, a senior lawyer at the Law Center to Prevent Gun Violence, based in San Francisco.

“It’s a big problem,” she said. “The intent of the Legislature was clearly to prohibit assault weapons, but the gun manufacturers have exploited a loophole in the law. It means that a whole set of guns that should be banned in California are still available.”

Gun makers argue that the bullet button was approved by state officials in 2000 and should not be viewed as a loophole. Rather, it was “simply the industry trying to comply with the State of California’s law and regulations” in order to continue selling a popular firearm, according to the National Shooting Sports Foundation, which represents manufacturers.

Eric Schmitt contributed reporting from Washington.

A version of this article appears in print on , on Page A23 of the New York edition with the headline: Attack Showed That Legally Bought Firearms Do Not Always Remain Legal. Order Reprints | Today’s Paper | Subscribe