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.

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. But 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.

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. Those whose magazines previously had been "grandfathered" were required to alter them or get rid of them.

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

More:What we know about the mass shooting at a Thousand Oaks, California, dance bar

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

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."

'He died a hero':Ventura County Sheriff Sgt. Ron Helus among those killed in Thousand Oaks bar shooting

More:Some Thousand Oaks victims survived mass shooting in Las Vegas, reports say

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.

There is also a minimum 10-day waiting period and in addition to the federally-mandated background check, the California Department of Justice is required to check its own records and records from the Department of State Hospitals, according to the Giffords Law Center.

Gabby Giffords, a former Democratic member of the House of Representatives, was shot along with 18 others while meeting with constituents in 2011. The gunman in that attack used a Glock 19 pistol and carried two 33-round magazines, according to The Washington Post.

Under federal law, a person has to be 21 to buy a handgun from a dealer and 18 to get a handgun from an individual. Rifles and shotguns can be sold to people 18 and over, and unlicensed individuals can give them to people of any age, according to the Giffords Law Center.

Under the 1968 Gun Control Act, anytime someone buys two or more handguns within five days, it must be reported to the Bureau of Alcohol, Tobacco, Firearms and Explosives.

Because of concerns about guns being run into Mexico, multiple rifle sales must also be reported to the ATF in the four southern border states: Arizona, California, New Mexico and Texas. That policy expires in 2021. Outside of those states, multiple rifle or shotgun sales in other states do not have to be reported, regardless of the number.

"California has among the strongest gun laws in the nation and as a result, thankfully, incidents like this occur much less frequently in California than they do in states with more permiss gun laws," Skaggs said,

"But as today made abundantly clear, as San Bernardino made abundantly clear, even in California the risk of this kind of horrific shooting is unavoidable."

Contributing: The Associated Press