It's been more than three weeks since 17 people died in a mass shooting at Marjory Stoneman Douglas High School in Parkland, Fla.

The 19-year-old accused in the shooting used a military-style rifle he bought legally after passing a background check.

The attack has reignited the debate over the effectiveness of the current system. People on both sides of the gun debate agree it needs fixing. The question is how.

The NRA and other gun rights advocates want existing rules used more efficiently. They don't want new restrictions. Right now, background checks are required only when guns are sold by licensed gun dealers. Private sellers are exempt.

Resistance to expanding checks remains strong. Those who own or want to purchase guns worry that increased background checks will lead to gun registration, and ultimately gun confiscation.

Gun control advocates want that expanded - universally - to include all gun sales, retail or private.

Currently, 18 states and Washington, D.C., have expanded their background checks to include private sales, though implementation of these checks varies from state to state. Nevada passed a similar law, but it hasn't been used. Residents recently sued Nevada Governor Brian Sandoval for failure to implement the law.

As the gun debate and the debate about background checks continues, here's what you should know about how they work:

What is a background check?

A background check identifies those who are prohibited from buying firearms. The core goal of a background check is to prevent guns from getting in the hands of dangerous people who want to harm themselves or others.

How does a background check work?

When a person goes to a licensed gun dealer to buy a gun, they fill out this form and answer questions about their background and criminal history. The dealer then contacts the National Instant Criminal Background Check System (NICS), and sends the form and the person's social security number.

The NICS was launched in 1998 to provide information in minutes that before had taken up to five days.

The NICS scans information from three federal databases:

  • National Crime Information Center (NCIC): Contains information about fugitives from justice, terrorists, and those subject to domestic violence protection orders.
  • Interstate Identification Index (III): Fingerprints of people charged with felonies or misdemeanors are submitted to this federal system by all states.
  • NICS Index: Created specifically for the NICS to help in conducting gun-related background checks. Local, state, tribal, and federal agencies contribute to this database any disqualifying information about people that isn't otherwise available.

In at least 90 percent of cases, the background check is completed almost immediately. If the dealer gets the green light, the person can purchase the gun without further questions.
Since 1998, the NICS has processed more than 282 million federal background checks but the FBI says that number does not represent the total firearms sold.

Many states have their own laws and regulations as well.

What happens if the background check isn't completed automatically?

Sometimes background checks require more time. This can happen for a number of reasons, like if the person in question has a long history of criminal behavior or if the records are unclear or incomplete.

Under federal law, the FBI has three days to investigate further. If the dealer doesn't hear from the FBI within three days, he or she can then sell the gun to the person requesting the background check.

It was this "default proceed" rule that allowed the gunman in the 2015 Charleston, South Carolina, church shooting to purchase a gun. Nine congregants of the Emanuel African Methodist Episcopal were killed.

In that case, Dylann Roof was sold a gun because his background check wasn't returned within three days. When the background check finally came back, he didn't pass based on a drug charge.

What happens if a background check is declined?

As of January 2018, the FBI had returned just over 1.5 million total denials. That represents only 0.5 percent of the total background checks in the 20 years the NICS has been in use. The gun dealer only sees the denial - he or she doesn't get any information about why the background check was turned down.

What prohibits a dealer from selling someone a gun?

You can find the FBI's official reasons here. Most denials are caused by past criminal convictions. You also can be denied if you have had a restraining or protection order for domestic violence, if you are under indictment, or if you have been adjudicated for mental health.

Some buyers have gotten around the system by making illegal purchases on the black market, or having others with clean records buy the guns for them — they're called "straw buyers."

What are the flaws in the system?

Several experts point out that the usefulness of the NICS depends on how complete the records are in the three databases it scans. Mental health records are problematic because they can sometimes be incomplete. And while the federal government can compel federal agencies like the military to provide information, breakdowns still happen.

NPR's Tom Bowman reported in November 2017 that the Air Force failed to report the arrest and the conviction of Devin Patrick Kelley to the FBI. As a result, Kelley passed a background check and legally obtained a gun. He then killed 26 people, including children, at a church in Sutherland Springs, Texas.

State and local records also pose a problem when keeping the federal databases up to date.

A 2017 Bureau of Justice Statistics report said "it is widely understood and documented that state and local warrant systems have significantly more records than are reported to NCIC." For example, one NICS database was missing more than 70 percent of state criminal records, according to a 2014 Justice Department survey.

Ari Freilich, a staff attorney at Giffords Law Center to Prevent Gun Violence, admits background checks aren't the ultimate solution to gun violence. But, he says, they are an important first step. He compared the system to airport metal detectors.

Copyright 2018 NPR. To see more, visit