Republicans in Congress have tried to overturn D.C. laws that have legalized medical marijuana, needle exchanges and assisted suicide in the capital city.

This week, they tried but failed to stop a bill to decriminalize sex work before the D.C. Council even voted on the legislation.

Rep. Andy Harris (R-Md.) on Tuesday unsuccessfully attempted to insert language in the federal budget that would prohibit the city from spending local funds on enacting such a law.

“If this law passes, prostitution and all the things associated with it are decriminalized literally outside the doors of this building,” said Harris during a House Appropriations hearing.

“We don’t want this to be the red-light capital of the United States. We want people coming here not for sex tourism, but to come see the seat of government.”

With Democrats in control of the House, Harris has a tougher time restricting the District’s liberal policies. His amendment was promptly defeated on a 21-to-27 vote with all but one Democrat — Rep. Henry Cuellar of Texas — voting against it.

“It’s a local issue and Congress should butt out,” said Rep. Mike Quigley (D-Ill.), who chairs a panel that oversees D.C. affairs.

But the vote unleashed a flurry of emails from the National Republican Campaign Committee accusing various Democrats of supporting legalized prostitution.

D.C. Council member David Grosso (I-At Large), who is carrying the sex work bill, dismissed the surprise attacks from the Capitol.

“It’s bombastic rhetoric,” Grosso said.

“The reality is we have had an active population of both visitors and residents of the region who have come to the District of Columbia to engage in commercial sex work for hundreds of years,” he said. “This is nothing new. All we are doing is decriminalizing an act between consenting adults.”

Harris has long taken an interest in the affairs of D.C. municipal government. He is responsible for federal budget restrictions that prevent the city from taxing and regulating recreational marijuana sales. At one point, he even tried to void the city’s regulations on flushable wet wipes.

But Democratic House leaders support statehood for the District and oppose efforts to meddle in its affairs. No District restrictions have been added to the spending plan crafted in the House. That includes a longtime prohibition on the city using local dollars to subsidize abortions for low-income women.

The Republican-controlled Senate has yet to take action on the District’s budget. Observers expect the Senate to include the D.C. abortion prohibition in its spending bill because of pressure from antiabortion groups, but the prospects of other hot-button issues involving the District are unclear.

If the Senate were to restrict D.C. spending, it would be the subject of budget negotiations between the House and Senate.

Harris also did not attempt to revive his anti-marijuana provision that House Democrats stripped out of the budget. That’s welcome news to Mayor Muriel E. Bowser (D) who is pushing for the council to pass a law authorizing recreational pot dispensaries.

But the marijuana provisions could return later in the budget cycle or from the Senate. A spokesman for Harris did not return a request for comment.

On Tuesday, the new chairwoman of the House Appropriations Committee had an admonition for Republicans with opinions on the affairs of city hall.

“If members want to dictate what should be done with local dollars,” said Rep. Nita M. Lowey (D-N.Y.), “they ought to run for the D.C. Council.”