The House of Representatives moved Wednesday to block virtually all of the District’s gun restrictions, approving a budget amendment that would leave only federal law to regulate firearms in the nation’s capital.

The District’s gun laws are among the strictest in the country, and they have long been a target for conservative activists who tend not to live in the city but are still rankled by restrictions enacted by locally elected officials.

Rep. Thomas Massie (R-Ky.) on Wednesday offered an amendment that would prevent the city from spending funds to enforce local gun laws, including registration and education requirements for gun owners, bans on “assault”-type rifles and high-capacity magazines, and strict limits on carrying guns outside the home.

The Republican-controlled House approved the amendment and then the underlying appropriations bill, which includes the District budget. Whether the bill’s provisions become law will be subject to negotiation with Senate Democrats in the coming months.

The attack on the city’s gun laws followed another spending “rider,” which was added in committee to undermine a marijuana-decriminalization law scheduled to take effect Thursday. And a week ago, Sen. Rand Paul (R-Ky.) initiated an attempt to overhaul city gun laws through a proposed amendment to a Senate bill that ultimately died.

During a brief but fiery debate on the House floor Wednesday, Massie called the city’s gun laws “pure harassment” of its residents, and he said stricter gun regulations led to higher rates of violent crime.

“Why would the D.C. government want to harass and punish law-abiding residents that just want to defend themselves?” he asked. “Strict gun-control laws do nothing but prevent good people from being able to protect themselves and their families.”

Massie’s measure was denounced by two Democrats, Del. Eleanor Holmes Norton of the District and Rep. José E. Serrano of New York.

“It’s a flagrant abuse of democracy by a member who comes here with a tea party principle that says power should be devolved to the local level,” said Norton, who said Massie was “playing with the lives” of city residents, federal officials and visitors to the city.

After the amendment was approved on a voice vote, Massie asked for a roll call vote, and it passed 241 to 181.

In a statement released Wednesday, Massie noted that the Constitution grants Congress ultimate authority over District law and said it is “time . . . to step in and stop the D.C. government’s harassment and punishment of law-abiding citizens.”