WASHINGTON (AP) — A federal judge has upheld the gun-control law in the District of Columbia, which bans assault weapons and large-capacity magazines while imposing registration requirements for handguns and long guns.

In a ruling Thursday, U.S. District Judge James Boasberg said the city seeks to combat gun violence and promote public safety and that the current law does so in a constitutionally permissible manner.

The District of Columbia previously had one of the most strict gun control laws in the nation, but it was struck down in 2008 when the Supreme Court concluded that that the Second Amendment protects handgun possession for self-defense in the home.

The law upheld Thursday seeks to accommodate that constitutional right while also protecting the community from gun violence.