The sale of the high-capacity magazine used by a gunman who killed at least 12 people at a bar in Thousand Oaks, California, late Wednesday is prohibited under California law and possessing it would have been illegal, too, by a state law currently blocked by a federal court.

Related: Group That Survived Las Vegas Shooting Was at California Bar

Sheriff Geoff Dean said the gunman, who was also killed, was armed with a Glock 21 – a .45-caliber, semi-automatic handgun.

"The weapon was designed in California to hold a magazine of 10 rounds and one in the chamber, but he had an extended magazine on it," Dean said.

Dean did not specify the size of the extended magazine, but most high-capacity magazines for the gun that are for sale online hold 26 rounds. "Drum" magazines that are compatible with the handgun can hold as many as 40 rounds.

California has outlawed the sale of magazines larger than 10 rounds since 2000 but owners who owned larger ones before the law took effect were permitted to keep them.

Related: These are the victims of the California Thousand Oaks shooting

In 2016, California voters approved a proposition in the wake of the San Bernardino shooting, which made it illegal to possess magazines capable of holding more than 10 rounds.

Gun control advocates argued the previous law was not effective because there was no way to determine when or where a high-capacity magazine was purchased. Those whose magazines previously had been "grandfathered" were required to alter them or get rid of them.

Before the new law could take effect, it was blocked by a federal judge after a lawsuit by the California Rifle & Pistol Association, the state National Rifle Association affiliate, argued the law was unconstitutional. The U.S. 9th Circuit Court of Appeals upheld the injunction pending the resolution of the lawsuit.

Related: What we know about Thousand Oaks gunman Ian David Long, a Marine veteran

Adam Skaggs, chief counsel for the Giffords Law Center to Prevent Gun Violence, said the magazine used in Thousand Oaks was probably obtained illegally because it's unlikely the 28-year-old gunman purchased before the 2000 law was passed.

"It just confirms the serious safety risks that these magazines entail," Skaggs said.

"When someone is forced to stop and reload it creates an opportunity to escape. It creates an opportunity to try and disable the shooter. That's why restricting access to these is so important in terms of making mass shootings less deadly."

Skaggs said it is no single gun law can prevent every mass shooting and that it is impossible to know if the shooter would have obtained a high-capacity magazine with or without the "unfortunate" court injunction.

But he said that if the law prohibiting high-capacity magazines is "enforced and put into effect, it's going to reduce the number of potentially dangerous shooters who have access to these types of devices, and in the long run will save lives."

Gun rights activists argue that the government cannot prevent all acts of violence and that people are safer when they exercise, rather than restrict, the Second Amendment.

"Once more we see the devastating effects of the illusion of safety that gun control laws and policies are founded upon," the Firearms Policy Coalition said in a statement Thursday. "Gun control proponents like Gavin Newsom, California’s incoming governor, are irrationally committed to passing more and more laws that just do not prevent violent people from doing evil things."

California has some of the more restrictive gun laws in the country and federal law is somewhat stricter when it comes to handguns.

Anyone who buys or is given a handgun in California has to get a state-issued firearm safety certificate, which comes with a fee of up to $25 and must be renewed every five years.

In California, even "private party transfers" – such as those at gun shows – must involve a licensed firearms dealer, unless the person is giving or selling the gun to a family member.

Concealed carry permits in California can be issued by a sheriff, if a person can show that they need one. The state does not honor carry permits issued by other jurisdictions. On Monday, the Supreme Court rejected an appeal from California residents challenging the law.