With just hours before the midnight deadline to register to vote, President Barack Obama signed the first federal gun control law in more than a decade, barring gun purchases by people over 21.

Gun-control advocates were bracing for a backlash.

The measure was seen as a slap in the face to gun owners who fear they will lose access to their guns if they try to register, and it drew harsh criticism from Democrats.

“We’re trying to make sure that if somebody is at a gun show, or they’re going through a background check, they have a chance to have their gun safely stored in their safe,” said House Speaker Nancy Pelosi, D-Calif.

“We have to make it absolutely clear that if you want to purchase a firearm, you should have to go through a thorough background check.”

The measure also bans gun sales by people who are in the country illegally.

It also limits the amount of ammunition that can be carried on Amtrak trains and other public transportation.

The bill is one of several Obama signed Monday as part of his efforts to stem the tide of mass shootings that have killed at least 26 people in the United States this year.

The law will allow states to issue concealed carry permits to any U.S. citizen over 21 who meets certain criteria.

Applicants will also need a fingerprint background check and an annual renewal.

It is not yet clear how many people are expected to apply for permits in states such as California and Oregon, but the number of gun owners registered in those states is expected to be higher than in states where the federal gun ban goes into effect.

In addition to California, other states that will begin issuing permits include Arizona, Georgia, Idaho, Kansas, Montana, New Hampshire, North Dakota, Ohio, Oklahoma, South Dakota, Texas and Wyoming.

The president’s announcement was made in a televised address to law enforcement officials in the Oval Office, where he also signed a bill that extends gun registration requirements for three years.

The bill also extends the federal waiting period for gun owners to check to see if they are eligible to purchase guns.