At least 10 people were killed Friday after a gunman opened fire at Santa Fe High School in Santa Fe, Texas.

The victims are mostly students, The Associated Press reported.

The incident comes just six months after 26 people were killed when Devin Kelley opened fire at the First Baptist Church of Sutherland Springs in November.

In light of recent attacks, here’s what you need to know about Texas gun laws.   

Texas gun law 101

Gun critics argue that Texas gun laws are relatively lax. But Justin Sparks, a Firearms Program Attorney through the Texas Law Shield, a legal defense fund, told Fox News that “Texas is probably the middle of the pack,” adding that “there’s not a lot of prohibiting, but there is a lot of supervising.”

“Generally speaking, in Texas, as long as you’re of age [18] and can pass the background check, you can buy a gun,” Sparks told Fox News.

However, a person must be 21-years-old before they can buy a handgun, he said.

Sparks added that there’s no special license to purchase a gun in Texas. According to the lobbying arm of the National Rifle Association, “a Texas resident, if not otherwise precluded by law, may purchase rifles and shotguns, ammunition, reloading components, or firearms accessories in contiguous states.”

There’s also no license to carry a gun once it’s purchased, he said. However, a permit is required to carry a handgun. And thanks to a bill that was passed in the Texas Legislature in 2015, handgun permit holders can now carry their handguns openly, Sparks said.

Overall, gun owners can keep the firearm in their home, vehicle or place of employment if their place of employment allows firearms in the building. In order to take it outside of those areas, however, a license is required, Sparks said.

Problems typically arise when “someone goes and buys a firearm and doesn’t educate themselves on where they can carry it, or leaves it out in the open in their car,” he said.

Who cannot buy a gun in Texas?

Texas adheres to federal law when it comes to who can and cannot buy a gun, Sparks said.

If a person has been convicted of a felony, they cannot buy a gun. Firearm distributors who have a Federal Firearm License, or a FLL, can easily find out if someone has been convicted of a felony by running a background check, Sparks said.

Additionally, if a person is under indictment for an “offense that can land you in jail for more than a year,” Sparks said, you cannot have a firearm in Texas.

But five years after a convicted felon completes his or her sentence, they can own a gun again -- if they keep it in their home. However, Sparks acknowledged that this Texas law conflicts with federal law-- meaning that if it’s reported, it could result in that person’s arrest.

Additionally, those who are deemed “mentally unfit” by the state are prohibited from owning a gun -- an issue that Sparks said is “evolving” within the Texas legislature.

“I wouldn’t be surprised if the state eventually passes something that requires a disclosure of all mental health records-- even if they [the gun purchaser] were at a private mental health facility,” he said.

Given his background, how did Devin Kelley get a gun?

Devin Kelley previously served in the U.S. Air Force, but was discharged in 2014, an Air Force spokesperson confirmed to Fox News.

He was court-martialed in 2012 for assaulting his wife and child. He was then sentenced to 12 months in custody before being given a bad conduct discharge.

A 1968 Gun Control Act made it unlawful for a licensed firearms dealer to sell a weapon to any person who is given a dishonorable discharge. But because Kelley was discharged on bad conduct, the law was not triggered, Adam Winkler, a professor of law and a specialist in American constitutional law at the University of California at Los Angeles, told Fox News.

Kelley purchased two firearms from two separate Academy Sports + Outdoors stores in San Antonio in 2016 and 2017, respectively, the sporting goods store confirmed to Fox News in a statement on Monday. One of the purchases was allegedly a Ruger model AR-556 rifle.

“We also confirmed that both sales were approved by the National Instant Criminal Background Check System (NICS). We are cooperating with law enforcement as they investigate further,” the statement reads.

However, Kelley’s domestic violence charges should’ve been enough to prevent him from purchasing a gun, Winkler said -- but the Air Force most likely didn’t report this information to the federal background check system, thus allowing the purchase to go forward.

“The underlying crime [domestic violence] in and of itself should’ve been enough,” Winkler said. “But for some reason, the military hasn’t been reporting bad conduct discharges.”

And Winkler’s prediction was right: The Air Force announced the Holloman Air Force Base Office of Special Investigations -- the base where Kelley was stationed -- failed to report Kelley’s domestic violence conviction to the FBI’s Criminal Justice Investigation Services Division for inclusion in the National Criminal Information Center database. The database is used to conduct background checks on those who want to purchase a gun.

If the Air Force had reported the conviction, the purchase would’ve been prevented because of the  Lautenberg Amendment, which enacted by Congress in 1996. The federal law prohibits people convicted of domestic violence from buying or possessing a gun.

In response, the Heather Wilson, the secretary for the Air Force, told “Fox and Friends” that the Air Force is launching a “complete and full-scale review of this case and all others like it” to ensure something similar doesn’t happen in the future.

“If we find a problem, we’ll fix it,” she added.

The gunman was also denied a Texas handgun permit, Texas Gov. Greg Abbott told “Fox & Friends.”

"He was rejected either because he did not fully answer all the questions that are required to get a Texas gun permit, or he answered those questions wrong, that we still don't know," Abbott said.

The “biggest mystery,” Winkler said, is how Kelley was denied a handgun permit but was allowed to purchase a gun from the sporting goods store. But this information is currently unclear.

Additionally, Texas authorities confirmed Kelley did not have a license to carry. However, he did have a private security license -- often used by armed and unarmed security guards, personal protection officers, private investigators, and more, according to the Texas Department of Public Safety.

A criminal background check is typically required before someone can receive a private security license.