At the beginning of July, a man on a bike stopped near a crowded Old City bar and warned patrons that “no one is wearing a mask.” In response, the owner of a nearby bar — Jamie Atlig, who owns nearby Infusion Lounge — pulled a gun.

News of the incident spread quickly. Replying to criticism, Atlig’s lawyer, Robert Gamburg, said: “Mr. Atlig is licensed to carry a firearm. He has extensive firearm training. He’s a business owner and he was being threatened. The individual reached behind his back for an object, Mr. Atlig unholstered his licensed firearm, defused the situation, and sat back down.”

The story caused a lot of people to ask: Just what are the gun rules in Philly and in Pennsylvania? We break down some of the basics of buying and carrying firearms:

How do background checks work in Pa.?

Neither Pennsylvania nor Philadelphia requires a license or permit to buy a firearm, and there is no waiting period before a buyer can take a gun home.

But people do need to undergo a background check to buy handguns or long guns (such as rifles and shotguns) from a licensed dealer in the state.

Pennsylvania State Police perform the background check over the phone with the dealer using the Pennsylvania Instant Check System (PICS) and National Instant Check System (NICS). The check, said staff attorney David Pucino of Giffords Law Center to Prevent Gun Violence, includes a search of records on criminal history, mental health, and juvenile delinquency.

Not all gun sales get background checks, though. The state also allows for private sales of long guns with no background check. But, Pucino said, that exemption does not extend to the sale or transfer of handguns, which still require a background check, and must be done through a licensed dealer or county sheriff’s office.

Typically, background checks are instant, and state police quickly deny or approve the sale of a firearm. According to Pennsylvania statistics, the state police conducted about 317,319 firearm purchase background checks between April and June, of which only 5,801 were denied.

Who can and can’t buy a gun?

To purchase a handgun, a person must be at least 21 years old, and at least 18 to purchase a long gun. But there are a number of factors that can disqualify someone from legally buying a gun in the state.

Pennsylvania law, for example, prohibits people from buying firearms if they have been convicted of any of a number of crimes, including murder, manslaughter, burglary, robbery, arson, aggravated assault, rape, and other serious offenses, or have been convicted of three separate DUI charges in a five-year period.

Additionally, people who are undocumented immigrants, have been involuntary committed to a mental institution, or are subject to an active protection from abuse order are also prohibited from buying firearms.

The restrictions are not absolute: People who are barred from buying a gun can apply to the courts for permission, and if the most recent conviction is more than 10 years old, the courts have to reinstate the ability to buy a firearm.

What about carrying guns in Pennsylvania?

Generally in Pennsylvania, openly carrying a firearm — or carrying a gun that is visible, like in a hip holster — is legal and does not require a permit of any kind.

That is true everywhere in the state except for Philadelphia, which is considered a “city of the first class” because of its population size. So in Philadelphia, you need to have a license to carry a gun, whether it’s open carry or concealed.

But you do need a permit to carry a concealed firearm everywhere in Pennsylvania. Known as a License to Carry Firearms (or LTCF), it’s available to people age 21 and over, and is granted by the local sheriff — or, in Philadelphia, the chief of police. Permits are valid for a period of five years.

Getting a permit means passing an investigation that determines that you aren’t disqualified from having the license. What does that mean? The state police say that applicants can be denied if the “character and reputation of the individual are such that they would be likely to act in a manner dangerous to public safety.” Prohibited people include “habitual drunkards,” unlawful users of marijuana or other drugs, those dishonorably discharged from the armed forces, and people prohibited from possessing or purchasing firearms, among others.

Philadelphia also conducts an in-person interview and a background investigation. Investigations must be completed within 45 days.

It’s worth noting that Pennsylvania is known as a “shall-issue state” when it comes to concealed carry permits. Essentially, Pucino says, in a shall-issue state, “if you are not disqualified, you shall be issued a license.” Some other states are known as “may-issue states,” which allows authorities a little more discretion to disqualify someone if they think that person should not carry a gun.

Some county courthouses and sheriff’s offices in Pennsylvania have closed because of the coronavirus pandemic, leading to extensions on expiring permits. Currently, permits expiring on March 19 or later are valid through Sept. 30, the state police announced this week.

Where can’t guns be carried?

Generally, Pennsylvania law does not require a concealed carry license to carry a firearm in your home or place of business. But even with a license, there are certain places that are off-limits.

Among them: court facilities, detention and corrections facilities, mental health facilities, federal facilities, schools, and TSA security checkpoints and airplanes.

The Philadelphia Code also allows the commissioner of public property and the commissioner of parks and recreation to “promulgate regulations prohibiting the carrying of any firearm or deadly weapon in or around any city-owned or city-occupied facility,” such as city parks, Pucino said.

But it’s complicated. Last year, City Council passed a measure that would prohibit people from carrying guns in city parks and rec centers, but the state probably won’t allow it to be enforced because courts have ruled that state law preempts cities when it comes to gun regulation.

Loaded or unloaded handguns generally cannot be carried in vehicles, unless the person is an LTCF holder (or meets other limited exceptions, such as traveling to or from target practice, in which case the weapon cannot be loaded). Long guns, meanwhile, cannot be carried loaded in a vehicle whether you have a concealed carry license or not.

Pennsylvania does not specifically prohibit firearms in bars or other places where alcoholic beverages are served or sold.

What about businesses that have a ‘no firearms’ sign? Pucino says it is “not clear” whether “no firearms” signs posted in private businesses in Pennsylvania — such as bars or grocery stores — are legally binding.

“If a place posts and says, ‘Do not bring firearms in here,’ I would tell anyone that they shouldn’t bring a firearm in there,” he said. “It’s not clear if you need to be specifically told that you can’t have a firearm in there, or if the posting is sufficient.”