You have to be 21 to buy a handgun at a store, but only 18 to get one at a gun show.

The U.S. Constitution only provides age requirements for two things: holding political office and voting. It says you can be a House representative at 25, a senator at 30, and a president or vice president at 35. The 14th and 26th Amendments both dealt with the voting age, with the latter setting it at 18. But other than that, there are no guidelines about how old you need to be to do anything else, like smoke, drink, marry, drive—or buy a gun.

The debate over guns in particular has become more fervent since 17 people died in the Marjory Stoneman Douglas High School shooting on February 14, 2018. The revelation that the 19-year-old gunman used an AR-15 he bought legally in Florida has reinvigorated a decades-old debate over whether assault weapons should be banned.

It’s also highlighted a seemingly nonsensical aspect of federal gun law. Licensed arms dealers can’t sell handguns to anyone under 21, yet they can sell AR-15s, which are classified as rifles or long guns, to anyone 18 and older. In other words, the Stoneman Douglas shooter was too young to buy a handgun at a store, yet old enough to buy something more deadly.

Second Amendment Sports, a gun shop in Tucson, Arizona, 2016. Didier Ruef/Cosmos/Redux

These inconsistencies can be traced back to 1968, the first year the federal government set age limits for gun purchases. Before then, regulation for non-machine guns was mostly left to states. It’s not clear whether states had formal age restrictions for guns, but gun access in some states may have followed the “age of majority,” i.e. the age at which you were considered a legal adult. The age of majority is often tied to the age when you start voting, and for most of U.S. history, it was 21, says Akram Faizer, a law professor at Lincoln Memorial University.

But then the 1960s brought the assassinations of John F. Kennedy, Robert F. Kennedy, and Martin Luther King, Jr., as well as a feeling among some Americans that increased law and order was needed to quell unrest, especially among young people. In response to these factors, the Gun Control Act of 1968 established the first federal age limits for buying guns from licensed dealers: 18 for long guns and 21 for handguns. The distinction was due to the fact that handguns were associated more with homicide (and today still account for most gun deaths) than long guns. However, it set no age limit for possession, and no age limit for purchasing guns from a private seller.

Dr. Ralph Abernathy, Jesse Jackson and others standing on the balcony of Lorraine Motel and point in the direction of gun shots that killed American civil rights leader Dr. Martin Luther King, Jr., who lies at their feet. Joseph Louw/The LIFE Images Collection/Getty Images

In 1994, the Violent Crime Control and Law Enforcement Act doubled down on the inconsistencies in gun purchasing age limits. This law said that you had to be 18 to possess or buy a handgun, while still leaving in effect the 1968 law’s stipulation that licensed dealers could only sell handguns to persons 21 and over, says Jon Vernick, deputy director of the Johns Hopkins Center for Gun Policy and Research.

“So it leaves us in a funny situation under federal law,” he says. “There’s this weird gap where you have to be 18 to buy a handgun from a private person but 21 to buy it from a licensed dealer.” Like the 1968 law, this new act did not set any minimum age for long gun possession or purchase from a non-licensed vendor.

“You have to be 18 to buy a long gun from a licensed gun dealer,” Vernick explains. “But if instead of knocking on the door of my local gun store, I knock on my neighbor’s door, and that person wants to sell me a rifle or a shotgun, I can be 11.”

Though states can place extra restrictions on gun sales and possession, the federal age limits related to guns have not changed since 1994. This means that although 18-year-olds can’t buy handguns at a store, in many parts of the country they can still get them through a gun show, online retailer, or yes, even a neighbor.