The Supreme Court has made a ruling over the purchases of guns for other people.

According to USA Today, the court’s ruling came after two lower courts had already ruled against what is known as straw purchases. Individuals who purchase guns are required to make a report when they buy guns that are for others.

NBC News reported that Justice Elena Kagan said the law is used to prevent individuals from having guns if they are mentally ill or have had criminal convictions in the past.

The case came after a former police officer, Bruce Abramski Jr., bought a handgun for his uncle in Virginia. He had reportedly filled out a form stating he was the person who was actually buying the gun. Even though his uncle was licensed to carry a gun, the police officer would not have been able to purchase the gun from the dealer.

The Associated Press reported that the gun laws were in place to prevent firearms from being given to people who could not legally own a weapon. Their ruling means that the law is enforced even if the person who will ultimately own the weapon is legally allowed to have a gun.

Abramski’s defense was he couldn’t be a straw purchaser since his uncle could buy guns. He also argued Congress’ goal of preventing weapons from being given to convicted felons would not be “furthered” if the person owning the gun was allowed to own guns.

However, the Obama administration argued since the law requires dealers to run background checks on individuals who buy guns, it would be difficult to accept Abramski’s defense since law enforcement would have a difficult time tracing weapons used for criminal offenses.