The US Supreme Court on Friday upheld a federal law prohibiting domestic abusers from possessing a firearm, the latest legal ruling in the country’s fierce battle over gun rights.

It was the first gun case to come before the court — where conservatives hold a 6-3 majority — since a major decision issued in 2022 loosening gun restrictions.

“When an individual has been found by a court to pose a credible threat to the physical safety of another, that individual may be temporarily disarmed consistent with the second amendment,” Chief Justice John Roberts wrote in the 8-1 opinion.

“Since the founding, the nation’s firearm laws have included regulations to stop individuals who threaten physical harm to others from misusing firearms. As applied to the facts of this case, (the law) fits comfortably within this tradition,” Roberts said.

In the 2022 decision, the nation’s highest court said it would authorize only “reasonable” exceptions to the Second Amendment right to bear arms and would rely on historical precedents when it comes to regulating firearms.

That ruling left lower courts struggling to determine whether gun restrictions before them were consistent with “the history and traditions” of firearms regulation in the United States in the late 18th to the 19th century.

An ultraconservative appeals court ruled in March that a federal law banning gun ownership by people with domestic violence restraining orders was unconstitutional, for lack of historical precedent.

“A woman who lives in a house with a domestic abuser is five times more likely to be murdered if he has access to a gun,” Solicitor General Elizabeth Prelogar said in November last year as she made the case for upholding the federal law for the Biden administration.

“Congress may disarm those who are not law-abiding, responsible citizens,” she added.

“Throughout our nation’s history, legislatures have disarmed those who have committed serious criminal conduct or whose access to guns poses.

She cited minors, individuals with mental illness, felons and drug addicts as among those prohibited from possessing firearms.

Indicating his agreement with the government’s position, Roberts — one of the bench’s conservatives — wrote that “some courts have misunderstood the methodology of our recent second amendment cases. These precedents were not meant to suggest a law trapped in amber.”

In the case before the court, police recovered a handgun and a rifle during a search of the Texas home of Zackey Rahimi, who had been implicated in five shootings in two months and was subject to a protective order on behalf of a former girlfriend which prohibited him from owning weapons.

Rahimi’s attorney Matthew Wright argued that there was no historical precedent for depriving his client of firearms without there being an actual conviction for a crime.

Dissenting from the court’s opinion, conservative Justice Clarence Thomas said states already have criminal prosecution as a tool for disarming anyone who uses a firearm to threaten physical violence.

“Most states, including Texas, classify aggravated assault as a felony, punishable by up to 20 years’ imprisonment… Thus, the question before us is not whether Rahimi and others like him can be disarmed consistent with the second amendment,” Thomas wrote.

“Instead, the question is whether the government can strip the second amendment right of anyone subject to a protective order — even if he has never been accused or convicted of a crime. It cannot.”

Some 100 gun control activists, including the actress Julianne Moore, carrying signs reading “Disarm Domestic Abusers” staged a demonstration outside the Supreme Court as the justices heard about 90 minutes of oral arguments last year.

Senator Amy Klobuchar, who filed a brief urging the court to uphold the ban, said in a statement the justices had protected a “common sense law that has been in place for 30 years.”

“Even with today’s outcome, we know there is more work to be done,” she added.